Sunday, 31 March 2013

How to parse comma delimited string into IN Clause in SQL Server

declare @commasepvalue varchar(50)='rashmi,ashish,punit,vishal'

select q2.value from

(SELECT cast('<x>'+replace(@commasepvalue,',','</x><x>')+'</x>' as xml) as thexml)q1 CROSS APPLY

(SELECT x.value('.','varchar(100)') as value FROM thexml.nodes('x') as f(x))q2

 
and Output will be----

Table Partitioning in SQL Server

  Table Partitioning in SQL Server – Step by Step Partitioning in SQL Server task is divided into four steps: Create a File Group Add Files ...