Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
helixpoint
Constraint Violating Yak Guru
291 Posts |
Posted - 2009-03-22 : 09:39:56
|
| If there are no records, I want to return a 1, not a null.This does not workSELECT CASE WHEN MAX(priority) IS NULL THEN @nextPriority = 1 ELSE @nextPriority = MAX(priority) END FROM moviesDaveHelixpoint Web Developmenthttp://www.helixpoint.com |
|
|
helixpoint
Constraint Violating Yak Guru
291 Posts |
Posted - 2009-03-22 : 10:04:13
|
| got itSELECT @nextPriority = CASE WHEN MAX(priority) IS NULL THEN 1 ELSE MAX(priority)+1 ENDFROM helixpo_CLASSICDVDS.moviesDaveHelixpoint Web Developmenthttp://www.helixpoint.com |
 |
|
|
Nageswar9
Aged Yak Warrior
600 Posts |
Posted - 2009-03-22 : 10:05:59
|
| select isnull(max(priority),0)+1 from urtable |
 |
|
|
|
|
|