Click here to Skip to main content
15,895,084 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I just want to create ID for my Executives in my database.
how do I get Max(ID) if sql server returns null and how to show that first record in my window

Is there any function in sql server to return variable as 1 if Max()were null
Posted
Comments
Sandeep Mewara 3-Dec-10 6:58am    
Not clear.

1 solution

Try this,
Isnull(Max(ID),1)
 
Share this answer
 
Comments
fjdiewornncalwe 3-Dec-10 7:27am    
Simple and effective. This is how I would do it as well. Cheers.
aharisankar 3-Dec-10 7:39am    
Thank you very much sir,
This is the first time i'm asking a question and i got a beautiful answer from your end
it works well
Once again thank you very much sir.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900