question

MrWood avatar image
MrWood asked

What is the colon used for in T-SQL

I accidently created a query like this: Hello: SELECT * FROM TableA To my surprise, there were no syntax errors. Can someone tell me why the Hello: did not cause a syntax error? I searched the web and couldn't find an answer.
syntax
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

·
Kev Riley avatar image
Kev Riley answered
It defines a label, which you can then jump to using the GOTO statement https://docs.microsoft.com/en-us/sql/t-sql/language-elements/goto-transact-sql
1 comment
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

I should have known that! Even though I have used a goto since 1980. Thanks Kev
0 Likes 0 ·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.