Oracle to SQL Server (converting from character string) -
this code works in oracle, it's failing in sql server. i'm brand new sql server , not sure right way remedy is.
select case grouping(hiredate) when 0 hiredate else 'total' end hiredate, count(hiredate) count_hire_date faculty grouping rollup(hiredate);
trying this:
hire_date count_hire_date 1995 10 1996 20 1997 30 total 60
do utilize sort of cast in sql server or write prepare syntax error , work in sql server?
i think problem in case look , rollup, should this:
select (case when grouping(hiredate) = 0 convert(varchar(50),hiredate) else 'total' end) hiredate, count(hiredate) count_hire_date faculty grouping hiredate rollup
and please refer link : http://msdn.microsoft.com/en-us/library/ms178544.aspx
sql sql-server
No comments:
Post a Comment