Twitter

Follow SQLQuill on Twitter

Subscribe

MN Pass

TSQL Tip O’ the Week – 6/6/11 – Declare and Assign Variables

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: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:

Leave a Reply

  

  

  

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>