I tried running your SQL script through WinSQL and it returned all 10
lines. Try turning on ODBC tracing with WinSQL and see how is that able
to return all 10 lines.
[quoted text, click to view] seijin@gmail.com wrote:
> Is it possible to return messages from T-SQL using ODBC?
>
> For example, I'm running the following basic example from Wikipedia on
> T-SQL...
>
> DECLARE @Counter INT
> SET @Counter = 10
> WHILE @Counter > 0
> BEGIN
> PRINT 'The count is ' + CONVERT(VARCHAR(10), @Counter)
> SET @Counter = @Counter - 1
> END
>
> SQLGetDiagField() says there is only 1 record and SQLGetDiagRec() only
> returns the very first bit of information: "[Microsoft][ODBC SQL
> Server Driver][SQL Server]The count is 10" It doesn't count down with
> more messages.
>
> What am I doing wrong?