Thursday, March 02, 2006

The Terminator;

SQL Server 2005 - big changes - little changes. One of the little changes that's been a big change getting used to is the statement terminator, the semicolon. I've been forcing myself to place semicolons after every statement in my code, and going back through old code and adding the semicolons. They say that 21 days with a new behavior creates a habit. Maybe;

I have learned a few things about statement terminators;

1) You must place a semicolon at the end of the statement before a Common Table Element (CTE), otherwise the parser doesn’t know the WITH is starting a CTE and the batch will blow up like a bad action movie pun;

2) You can not place a statement terminator after the IF condition. Just treat the IF Condition -Next Statement as one long continuous statement;

3) You can not place a statement terminator between a END TRY and a BEGIN CATCH. Those two statements seem function as one single statement;

Right now statement terminators are optional, will they become required, maybe. I hear that one reason we don't have intellisense is that it's difficult to parse half written T-SQL without a statement terminator. Given the choice - I'd take required semicolons if that means we get intellisense;

I'll be back;

1 Comments:

At 11:50 PM, Blogger ipsteelfrance said...

Thanks for sharing such a useful blog.
Logiciel de sauvegarde pas cher
Carbonite Endpoint

 

Post a Comment

<< Home