Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re: DBI Invalid Cursor State when PRINT statements are embedded in SQL

by Grygonos (Chaplain)
on Oct 18, 2004 at 18:05 UTC ( #400252=note: print w/ replies, xml ) Need Help??


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.


Comment on Re: DBI Invalid Cursor State when PRINT statements are embedded in SQL
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.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://400252]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (3)
As of 2014-09-20 05:40 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (153 votes), past polls