Reputation: 335
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?
Upvotes: 1
Views: 1613
Reputation: 415
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.
Upvotes: 0
Reputation: 791
You need to use coalesce http://technet.microsoft.com/en-us/library/ms174075.aspx
The syntax is the same as the isnull.
Upvotes: 1