I've created sql stored procedure as below. In c# code i call this stored procedure to save it as txt file. The problem is,
1) the output not as what i want. I want the output for each field being start with left alignment
2) each field got specific length as what i already set in stored procedure...but it look like not working much
ALTER PROCEDURE [dbo].[AR_Ebill_claim]
(
@compcode varchar(15),
@dateFrom smalldatetime,
@dateTo smalldatetime,
@episType varchar (10),
@debtorCode varchar(30)
) AS
select
CAST(ProviderCode AS VARCHAR(30)),
CAST(MRN AS VARCHAR(25)),
CAST(PatName AS VARCHAR(50)),
CAST(PatNewIC AS VARCHAR(14)),
CAST(PatOldIC AS VARCHAR(10)),
CAST(PatID AS VARCHAR(14)),
CAST(RefNo AS VARCHAR(15)),
CAST(InvNo AS VARCHAR(15)),
(select CONVERT(VARCHAR, InvDate,103)) AS InvDate,
CAST(BillType AS VARCHAR(2)),
CAST(SvcType AS VARCHAR(2)),
(select CONVERT(VARCHAR, RegDate,103)) AS RegDate,
(select CONVERT(VARCHAR, DischgDate,103)) AS DischgDate,
CAST(ClaimAmt AS MONEY),
--sum(PayableAmount),
--SUM(AllocationAmount),
PayableAmount
from AR_Ebilling
where Company = @compcode AND
InvDate BETWEEN @dateFrom AND DATEADD(DAY,1, @dateTo) AND
BillType = @episType AND
DebtorCode = @debtorCode AND
paramsourcecode = 'pb'
and transtype = 'in'
and status = 0
