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.

About way0utwest

Editor, SQLServerCentral
This entry was posted in Blog and tagged , , . Bookmark the permalink.