in reply to DBI Invalid Cursor State when PRINT statements are embedded in SQL

I have never seen this syntax, and a quick look through the DBI book doesn't yield any likening to this syntax.

You really should just fetch the rows (individually or all at once) and then loop through and print them out if you're wantin to output the contents of a select statement.

P.S. - I have been known to be wrong many many times.

edit: popped open my sql server docs and found that it's a T-SQL function. My understanding has been that you can use T-SQL via ODBC, but I don't quite think you need to use it here. This may be one function that doesn't work within DBI::ODBC due to what state the cursor needs to be in for the T-SQL command to work.

P.P.S. Again ... I have been known to be very wrong.

Grygonos
  • Comment on Re: DBI Invalid Cursor State when PRINT statements are embedded in SQL

Replies are listed 'Best First'.
Re^2: DBI Invalid Cursor State when PRINT statements are embedded in SQL
by JamesNC (Chaplain) on Oct 18, 2004 at 18:18 UTC
    Thanks for the help. The syntax is valid in Sybase too. And I just verified that Sybase doesn't complain if it is at the begining, or anywhere else but nothing gets printed. It must act like a "GO" in that it never sent to the interpreter ever, but MSSQL doesn't like it.