Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
dmaxj
Posting Yak Master
174 Posts |
Posted - 2010-07-09 : 11:02:37
|
Why am I getting an error Msg 102, Level 15, State 1, Line 2Incorrect syntax near '='. My code follows:SELECT 'Production' AS Environment, @@SERVERNAME AS [Server] = CASE [Server] WHEN 'SQL01' THEN 'SQL01.HOME.ORG' END, loginname, sysadminFROM sysloginsORDER BY loginname Regards |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2010-07-09 : 11:05:27
|
| [code]SELECT 'Production' AS Environment, [Server] = CASE [Server] WHEN 'SQL01' THEN 'SQL01.HOME.ORG' END, loginname, sysadminFROM sysloginsORDER BY loginname[/code]MadhivananFailing to plan is Planning to fail |
 |
|
|
dmaxj
Posting Yak Master
174 Posts |
Posted - 2010-07-09 : 11:14:06
|
| Hmmm - that code give the expected error :Msg 207, Level 16, State 1, Line 3Invalid column name 'Server'.Thanks |
 |
|
|
dmaxj
Posting Yak Master
174 Posts |
Posted - 2010-07-09 : 11:25:04
|
| Ok - I figured it out:SELECT 'Production' AS Environment, CASE @@SERVERNAME WHEN 'SQL01' THEN 'SQL01.HOME.ORG' END AS [Server], loginname, sysadminFROM sysloginsORDER BY loginnameRegards |
 |
|
|
|
|
|
|
|