Service Broker - Dont forget your semi colons - SimonS Blog on SQL Server Stuff

Service Broker - Dont forget your semi colons

If you don't know semi colons have been made mandatory in some areas of SQL 2005 and it is likely that it will be required for many more going forward.

Of all the areas I've touched in SQL 2005 Service Broker is the most sensitive to the use of semi colons.

Simply put, you need semi colons at the end of every statement. Including IF statements with BEGIN END blocks.

From now on I'm turning on my C# coding to make sure I put ; at the end of statements

i.e. This is invalid

if 1=1

begin

print 'hello';

end

send on conversation @d ('hello')

What you need is

if 1=1

begin

print 'hello';

end;

send on conversation @d ('hello')



-
Published 03 October 2006 18:52 by simonsabin

Comments

06 October 2006 11:02 by SimonS SQL Server Stuff

# TSQL turning into C#

Following my previous post about the requirement of semi-colons when using service broker statements,...