Thursday, November 6, 2008

SQL .Net

When I started playing with Compound Operators and the new ability to assign a value in the variable declaration it brought me back to the days when I first started learning how to program in .Net. Honestly the first thing I wanted to type out of habit was .ToString(). Okay .ToString() may be a little far fetched, but there is some syntax in .Net that would make a some SQL code a lot cleaner. Take the following example.

Declare @i int = 1
Set @i += 1
Print @i.ToVarchar(4)

I guess Intellisence made me want to be able to do this even more. When I typed a dot after variable name, I almost expected a list of available methods.

The next thing I tried was #Region/#End Region to create code blocks. This does not work, but begin/end will create a region and keep the comments in the header.

Begin --Test Region 1
--Code Here

Then I tried adding --TODO: in a comment block to see if it would show up in the task list. No luck yet, but I am still playing with this one.