I'm looking for an efficient way to convert rows to columns in SQL server, I heard that PIVOT is not very fast, and I need to deal with lot of records. This is my example: -----------------------...
I have a table like this Value String ------------------- 1 Cleo, Smith I want to separate the comma delimited string into two columns Value Name Surname ------------------- 1 Cleo ...
I have a SQL Server 2008 R2 column containing a string which I need to split by a comma. I have seen many answers on StackOverflow but none of them works in R2. I have made sure I have select permissi...
I’m looking to split '1,2,3,4,5,6,7,8,9,10,11,12,13,14,15...' (comma delimited) into a table or table variable. Does anyone have a function that returns each one in a row?
Very simplified, I have two tables Source and Target. declare @Source table (SourceID int identity(1,2), SourceName varchar(50)) declare @Target table (TargetID int identity(2,2), TargetName varchar(...
I am attempting to merge something like this in my SQL Server database: [TicketID], [Person] T0001 Alice T0001 Bob T0002 Catherine T0002 Doug T0003 Elaine Into thi...
I am casting DateTime field to Time by using CAST Syntax. select CAST([time] as time) as [CSTTime] DateTime 2015-03-19 00:00:00.000 Present Output : Time 03:05:36.0000000 I need only HH:MM:SS and...
declare @t table ( id int, SomeNumt int ) insert into @t select 1,10 union select 2,12 union select 3,3 union select 4,15 union select 5,23 select * from @t the above se...
I have a table table1 in SQL server 2008 and it has records in it. I want the primary key table1_Sno column to be an auto-incrementing column. Can this be done without any data transfer or cloning ...
I have questionnaire data in, SQL Server 2008, that I want to transpose to a matrix. I saw several posts about the same topic, but I just don't get pivoting. Given are following tables: Question...