I’m starting a new series of posts that will have a TSQL tip. Some of them will be simple, some will be complicated, but hopefully they will all be helpful.
This weeks tip:
When using SQL 2008 use the feature that allows you to declare and set your variables in the same line. Here’s an example of how to do it:
Declare @tester varchar(100) = ‘This saves time’
Note – This saves a ton of time for debugging stored procedures – any default value can be left as is.
Here are some related posts from the blog-o-sphere:
- SQL SERVER 2008 – 2011 – Declare and Assign Variable in Single Statement – March 18, 2011 by Pinal Dave
- SQL 2008 Inline Variable Assignment – Feb 3rd, 2009 by Colin Stasiuk.


