Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
vmon
Yak Posting Veteran
63 Posts |
Posted - 2003-05-19 : 09:17:24
|
| I have done some MS Access programming and now am trying to learn SQL server. I used the debugger in Access to interactively step through logic, test and debug code. Is there a way to do this on stored procedures?vmon |
|
|
mohdowais
Sheikh of Yak Knowledge
1456 Posts |
Posted - 2003-05-19 : 09:34:27
|
| Yes, if you are using SQL Query Analyser 2000, you can right-click on a SP in the Object Browser, and select Debug. OS |
 |
|
|
X002548
Not Just a Number
15586 Posts |
Posted - 2003-05-19 : 14:27:34
|
| Never knew that...Always eyeballed the code...Debug is greyed out for me though...don't know why.Brett8-) |
 |
|
|
vmon
Yak Posting Veteran
63 Posts |
Posted - 2003-05-19 : 21:23:50
|
| I can do debug but can I do debug.print or see variable values as the proc executes? The debug function seems limited.vmon |
 |
|
|
robvolk
Most Valuable Yak
15732 Posts |
Posted - 2003-05-19 : 21:54:28
|
| You can use the PRINT statement to display results similar to Debug.Print, but you will not see the messages until the batch completes or is terminated by an error or RETURN statement. It is also a poor debugging practice you should avoid as much as possible.Debugging is a different animal in T-SQL because, even though it has some procedural features, it is NOT a procedural language and shouldn't be used as one. You never really need to examine a variable if set-based operations are used. You also should eliminate the use of cursors from your code...the VB approach to processing data is death in SQL Server. You are better off learning SQL/T-SQL, learning its capabilities, and writing procedures to take advantage them. It is different from VB and any other programming language and the only way to really learn to use it is to start over from the beginning. Trying to translate Access procedures to T-SQL will just leave you with poorly performing code. |
 |
|
|
|
|
|