Thursday, 29 June 2017

// // Leave a Comment

How to Generate Sequence without using Ranking functions in SQL Server?

Ans:
Spose you have a temp table with only one column 'A' as above, Now you can use following query to generate sequence




SELECT COUNT(*) OVER(ORDER BY A, CONCAT(A,NEWID())) RN,  A FROM #temp1




0 comments:

Post a Comment