| Author |
Topic |
|
WJHamel
Aged Yak Warrior
651 Posts |
Posted - 2012-03-27 : 15:26:14
|
| Just curious.In the 25 gazillion Insert Into statements i do every day, i have to bracket our columns that are titled [BEGIN] and [END] because SSMS gets confused. In what capacity in a query would the statements BEGIN and END be used where they are not column names? |
|
|
russell
Pyro-ma-ni-yak
5072 Posts |
Posted - 2012-03-27 : 15:34:41
|
Many ways. Here's one:IF OBJECT_ID('MyTable') IS NOT NULLBEGIN Drop Table MyTable ENDBEGIN/END is structural code. |
 |
|
|
X002548
Not Just a Number
15586 Posts |
|
|
X002548
Not Just a Number
15586 Posts |
|
|
sunitabeck
Master Smack Fu Yak Hacker
5155 Posts |
|
|
WJHamel
Aged Yak Warrior
651 Posts |
Posted - 2012-03-27 : 15:37:41
|
| Brett: don't get me started. I have to censor myself too frequently as it is. Eeesh. |
 |
|
|
russell
Pyro-ma-ni-yak
5072 Posts |
Posted - 2012-03-27 : 15:39:56
|
quote: Originally posted by sunitabeck See http://msdn.microsoft.com/en-us/library/ms190487.aspxFor example:DECLARE @i INT = 20;IF (@i < 10) BEGIN PRINT 'line 1'; PRINT 'line 2'; ENDELSE BEGIN PRINT 'line3'; PRINT 'line4'; END Then again And one more time 
lol. that's a lotta yaks  quote: Originally posted by X002548 Was this your Guru who named their Columns BEGIN and END?Brett
Other columns named ORDER, INT, CREATE... |
 |
|
|
X002548
Not Just a Number
15586 Posts |
|
|
WJHamel
Aged Yak Warrior
651 Posts |
Posted - 2012-03-27 : 15:53:07
|
| yeah, until some engineer, dba, or support person in my building stumbles upon my post. Then i get that ominous instant message. "Come see me in my office NOW". I walk into my boss's office and see "SQLTEAM.COM" up on his screen. |
 |
|
|
X002548
Not Just a Number
15586 Posts |
|
|
|