SQL Clone
SQLServerCentral is supported by Redgate
Log in  ::  Register  ::  Not logged in

Expected Variables–T-SQL Testing

After I wrote about creating tables that contain the results I expected, I wondered if I could do the same thing with variables. I was thinking that I’d like to better self-document my tests, and I’d like to be able to do this:

declare @TimeElapsed.Expected int = 25;

It turns out that I can’t. This gives me a syntax error and forces me to do this:

declare @TimeElapsed_Expected int = 25;

I can’t even do this:

declare @[TimeElapsed.Expected] int 

I’m slightly surprised, but not overly so. More sad that I can’t easily set variables that follow the same format.

Filed under: Blog Tagged: syndicated, testing, tsqlt

The Voice of the DBA

Steve Jones is the editor of SQLServerCentral.com and visits a wide variety of data related topics in his daily editorial. Steve has spent years working as a DBA and general purpose Windows administrator, primarily working with SQL Server since it was ported from Sybase in 1990. You can follow Steve on Twitter at twitter.com/way0utwest


Leave a comment on the original post [voiceofthedba.wordpress.com, opens in a new window]

Loading comments...