Question Locked

SQL server management studio - insert IF expression in view

0 helpful
3 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

I can enter a regular calculated expression into a view (as a calculated field using other fields of the db) but when I try using an IF expression it does not work. For some strange reason the error message is about incorrect syntax next to =.

Anybody knows if it is possible using IF functionms in this case (somebody told me it's not and I have to use stored procedures. Only weird for me that I can use other functions (SUM, LEFT) and build expressions but not IF.

3 replies

by tony hopkinson

A view must return a result set, allowing if would give the option of not doing so.

This discussion is closed to new replies.