|
Posted by Bill Bob on 10/01/67 11:40
Oops, I missed out the last line in the string varible. The last line
returns the calculated variable. The SQL docmentation says that Return
can only return integer types. so how do i return a money value. I
cannot insert into a temporary table because the application is
Multi-User and may fail.
WHILE @MinBook <= @iYear
BEGIN
SET @String = ' DECLARE @TT Money ' + char(13) +
' SELECT @TT = ISNULL( SUM( ISNULL(Debit,0) - ISNULL(Credit,0) ),0 )' +
' FROM transactions' + CAST(@MinBook AS CHAR(4)) + ' LEFT OUTER JOIN
dbo.Vouchers' + CAST(@MinBook AS CHAR(4)) + ' ON dbo.Transactions' +
CAST(@MinBook AS CHAR(4)) + '.VoucherID' +
' = dbo.Vouchers' + CAST(@MinBook AS CHAR(4)) + '.VoucherID ' + 'WHERE
(LedgerID = @iLedgerID)' + char(13) +
' Return @TT'
EXEC sp_executesql @String, N'@iLedgerID Int', @iLedgerID
SET @MinBook = @MinBook + 1
END
*** Sent via Developersdex http://www.developersdex.com ***
Navigation:
[Reply to this message]
|