i have a table student like
sname
-----
ram
ram
ram
raj
raj
raj
i need the output like
sname
-----
ram
raj
ram
raj
ram
raj
Answer Posted / sagun sawant
;with TEST as (select Row_Number() over (partition by sname
order by sname) as ROWNO,sname from student)
select sname from TEST order by ROWNO,(case when sname
= 'RAM' then 1
when sname = 'RAJ' then 2 end)
Is This Answer Correct ? | 9 Yes | 1 No |
Post New Answer View All Answers
What is the maximum size of a row in sql server?
Will sql server 2005 allow you to reduce the size of a column?
What are the lambda triggers?
Explain differences between web edition and business edition?
What is Transparent Data Encryption?
What is PROJECTION Operation?
How to download and install the scaled-down database adventureworkslt?
What are the restraints imposed on the table design by a merge replication?
What is parameterized reports in ssrs ?
What is log shipping? Can we do logshipping with SQL Server 7.0 - Logshipping is a new feature of SQL Server 2000. We should have two SQL Server - Enterprise Editions. From Enterprise Manager we can configure the logshipping. In logshipping the transactional log file from one server is automatically updated into the backup database on the other server. If one server fails, the other server will have the same db and we can use this as the DR (disaster recovery) plan.
What is the name of reporting services config file and what’s it’s used for?
How to drop existing views from a database in ms sql server?
Can you use order by when defining a view?
How to execute a stored procedure in ms sql server?
How to get the definition of a user defined function back?