print sql statement to be executed for debug
-
Monday, May 28, 2012 6:55 PM
Hi,
For debugging purpose, is there any way to print sql statement to be executed before their execution results? Ideally the feature can be turned on and off.
Thanks
All Replies
-
Monday, May 28, 2012 8:53 PMModeratorWhich version of SQL server are you using ?
Regards,
Ahmed Ibrahim
SQL Server Setup Team
This posting is provided "AS IS" with no warranties, and confers no rights. Please remember to click "Mark as Answer" and "Vote as Helpful" on posts that help you.
This can be beneficial to other community members reading the thread. -
Monday, May 28, 2012 9:14 PM
Basically SQL server 2008, some are R2 of 2008.
thx
-
Monday, May 28, 2012 9:41 PMModerator
But SSMS already display yellow cursor in front of the line being executed
Regards,
Ahmed Ibrahim
SQL Server Setup Team
This posting is provided "AS IS" with no warranties, and confers no rights. Please remember to click "Mark as Answer" and "Vote as Helpful" on posts that help you.
This can be beneficial to other community members reading the thread. -
Monday, May 28, 2012 9:44 PM
Oh, forgot to mention, the debug is for .sql files.
I.e., I want to execute the .sql file via sqlcmd, and not only viewing the execution results, but also the actual sql statement that yield those outputs.
Thanks
- Edited by smetah Monday, May 28, 2012 9:45 PM
-
Monday, May 28, 2012 9:52 PMModerator
Can you check-out approach in below thread
Regards,
Ahmed Ibrahim
SQL Server Setup Team
This posting is provided "AS IS" with no warranties, and confers no rights. Please remember to click "Mark as Answer" and "Vote as Helpful" on posts that help you.
This can be beneficial to other community members reading the thread.- Marked As Answer by smetah Monday, May 28, 2012 10:47 PM
-
Monday, May 28, 2012 9:57 PM
Thanks, in which it says,
" In MS SQL Server 2008(with our without R2), you have debug option present then you can directly analyze and debug your SPs."
where can I read more about it?
thx
-
Monday, May 28, 2012 10:02 PMModeratorThe context here is about SSMS, not sqlcmd, i was referring to the approach in Sandeep's post which was marked as answer to the thread.
Regards,
Ahmed Ibrahim
SQL Server Setup Team
This posting is provided "AS IS" with no warranties, and confers no rights. Please remember to click "Mark as Answer" and "Vote as Helpful" on posts that help you.
This can be beneficial to other community members reading the thread. -
Monday, May 28, 2012 10:45 PM
ok, but my question was on sqlcmd. Anyway.
thx
-
Tuesday, May 29, 2012 12:30 PM
- Marked As Answer by smetah Tuesday, May 29, 2012 2:39 PM
-
Tuesday, May 29, 2012 2:39 PM
Did you try the -e switch?
BINGO!
Thanks a lot for this simple solution!!!

