|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
I am using MS SQL Server 2000. I am reading right off of microsofts web site under Trasact-SQL Reference, on how to use the MIN function. Yet when I try to use it, I get the error:
'min' is not a recognized function name Here is the sql statement copied right out of Query Analyzer: select name, count(name), min( case when not(var6 = '') then 7 else case when not(var5 ='') then 6 else case when not(var4 ='') then 5 else case when not(var3 ='') then 4 else case when not(var2 ='') then 3 else case when not(var1 ='') then 2 else 1 end end end end end end as cols ) from syitabs where dupef=0 group by name |
|
#2
|
|||
|
|||
|
Code:
select
name
,count(name),
,min(case
when var6 <> '' then 7
when var5 <> '' then 6
when var4 <> '' then 5
when var3 <> '' then 4
when var2 <> '' then 3
when var1 <> '' then 2
else 1 end) as cols
from syitabs
where dupef=0
group by name
|
|
#3
|
|||
|
|||
|
Thanks,
I noticed that I needed to move then end parenthesis inside the "AS unfields". I like your way better though, because it doesn't need all of the ENDs: SELECT name, COUNT(name) AS unindexes, MIN( CASE WHEN NOT (var6 = '') THEN 7 ELSE CASE WHEN NOT (var5 = '') THEN 6 ELSE CASE WHEN NOT (var4 = '') THEN 5 ELSE CASE WHEN NOT (var3 = '') THEN 4 ELSE CASE WHEN NOT (var2 = '') THEN 3 ELSE CASE WHEN NOT (var1 = '') THEN 2 ELSE 1 END END END END END END) AS unfields FROM syitabs WHERE dupef = 0 GROUP BY name |
![]() |
| Viewing: Dev Shed Forums > Databases > MS SQL Development > 'min' is not a recognized function name |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|