You need to use coalesce http://technet.microsoft.com/en-us/library/ms174075.aspx
The syntax is the same as the isnull.
문제
I am using SQL Server Compact Edition as database for my Windows Application. I am having a problem while using ISNULL
. I wrote a query
SELECT
ISNULL(MAX(TransactionID) + 1, 100) AS TransactionId
FROM
TBLTransactionMain
But this query returns only true or false. Is there anything I can do to get the same result as in SQL Server 2008?
해결책
You need to use coalesce http://technet.microsoft.com/en-us/library/ms174075.aspx
The syntax is the same as the isnull.
다른 팁
The question is somewhat vague, but if your goal is to assume a value if TransactionID is NULL, then something like this is what you need:
MAX( ISNULL( TransactionId, 0 ) + 1, 100 ) AS TransactionId
Otherwise, you may need to clarify.