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 |
|
jfm
Posting Yak Master
145 Posts |
Posted - 2012-05-23 : 04:29:45
|
| Hi there, I made the following query, but I have: msg 156, level 15, state 1, line 2 incorrect syntax near the keyword "case"USE my_databaseCASE WHEN Column_E < Column_D THEN 0ALTER TABLE my_tableADD Column_Z AS (DATEDIFF(DAY, Column_A, Column_E))How can I solve the problem? Thanks |
|
|
Lumbago
Norsk Yak Master
3271 Posts |
Posted - 2012-05-23 : 05:01:26
|
| [code]USE my_databaseALTER TABLE my_tableADD Column_Z AS (CASE WHEN Column_E < Column_D THEN 0 ELSE DATEDIFF(DAY, Column_A, Column_E) END)[/code]- LumbagoMy blog-> http://thefirstsql.com |
 |
|
|
jfm
Posting Yak Master
145 Posts |
Posted - 2012-05-23 : 10:05:48
|
Perfect! Thanks a lot!quote: Originally posted by Lumbago
USE my_databaseALTER TABLE my_tableADD Column_Z AS (CASE WHEN Column_E < Column_D THEN 0 ELSE DATEDIFF(DAY, Column_A, Column_E) END) - LumbagoMy blog-> http://thefirstsql.com
|
 |
|
|
|
|
|