Yesup
 
 

Yamabay Knowledge Base

 

How to make SQL Server 2000 View support CASE WHEN

Previous Article Back to TOC Next Article

SQL Server 2000 View does support CASE ...WHEN T-SQL construct. But if you do not save the view in the sequence it accepts, it will complain that the View does not support CASE SQL construct and refuse to do so.


Let's assume you have the following SQL and you want to save it as a view:


SELECT au_fname, au_lname,
CASE state WHEN 'CA' THEN 'California' WHEN 'KS' THEN 'Kansas' WHEN 'TN' THEN 'Tennessee' WHEN 'OR' THEN 'Oregon' WHEN 'MI' THEN 'Michigan'
WHEN 'IN' THEN 'Indiana' WHEN 'MD' THEN 'Maryland' WHEN 'UT' THEN 'Utah' END AS StateName
FROM pubs.dbo.authors


If you new a view, paste the above to the edit window and save, it will complain. But if you parse it, by clicking verify SQL button, before save, it will complain when you click OK, but then you can save and later run it.


It sound like the Verify SQL step makes the difference.

Yesup
Top Stories Travel Movies Gift Ideas Free Software Games