Browse DevX
Sign up for e-mail newsletters from DevX

Tip of the Day
Language: SQL Server 6.5 and Up
Expertise: Beginner
Oct 3, 2003



Building the Right Environment to Support AI, Machine Learning and Deep Learning

A Simple Way to Debug a Stored Procedure

Debugging stored procedures can be a headache, but heres an easier way to trace a stored procedure's execution: Use the PRINT statement. PRINT lets you output and analyze variable values, which is sometimes good enough. Note a few restrictions when using PRINT:

  1. You can use only Char or VarChar data types. You must convert other data types to Char or VarChar in order to "print" them out.
  2. The printed string can be up to 8,000 characters long; any characters after 8,000 are truncated. (SQL Server 6.5 up to 255 characters long.)
  3. SQL Sever 6.5 doesn't allow inline concatenation of variables. SQL Server 7.0 and 2000 don't have this limitation.
Alex Grinberg
Comment and Contribute






(Maximum characters: 1200). You have 1200 characters left.



Thanks for your registration, follow us on our social networks to keep up-to-date