|
Posted by Erland Sommarskog on 02/18/06 00:49
NickName (dadada@rock.com) writes:
> env: sql server 2000
>
> objective:
> add a formula for an INT column to the FORMULA field or the DEFAULT
> VALUE field in DESIGN VIEW.
>
> all of the following attempts failed
> IIF (columnName = 0, "1", columnName + 1)
> IIF (columnName = 0, 1, columnName + 1)
> IIF (0, "1", columnName + 1)
I will have to admit that I don't understand much of your post.
IIF is Access/VB, but I guess you know that.
In case not, the syntax in SQL server is
CASE WHEN columnName = 0 THEN 1 ELSE columnName + 1 END
Then again, this can be simiplied to:
columnName + 1
--
Erland Sommarskog, SQL Server MVP, esquel@sommarskog.se
Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/prodtechnol/sql/2005/downloads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinfo/previousversions/books.mspx
[Back to original message]
|