Reply to Re: Returning Values from a Dynamic SQL

Your name:

Reply:


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 ***

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация