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 |
|
Ken Blum
Constraint Violating Yak Guru
383 Posts |
Posted - 2009-06-02 : 08:47:34
|
| Is there a system function that returns the maximum of 2 numerics/ints/floats? Somthing like SELECT MAXIMUM(1,0) would return 1? I know I could write one but I am just wondering if I am missing something. |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2009-06-02 : 08:57:45
|
No, there is not such a function. E 12°55'05.63"N 56°04'39.26" |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2009-06-02 : 09:09:31
|
| However you can simulate like thisdeclare @test table(i int identity(1,1),num1 int, num2 int)insert into @test (num1,num2) select 1,0 union all select 3,6select i,max(num1) as max_value from(select i,num1 from @testunion allselect i,num2 from @test) as tgroup by iMadhivananFailing to plan is Planning to fail |
 |
|
|
Ken Blum
Constraint Violating Yak Guru
383 Posts |
Posted - 2009-06-02 : 09:14:25
|
| CASE statement will have to do then. Thanks. |
 |
|
|
|
|
|