Sample table as Cities in rows is convert to single column
State (Tablename) ----- City (Columnname) ----- Chennai Madurai Coimbatore
declare @retstr varchar(8000) select Top 5 @retstr = COALESCE(@retstr + ';','') + City from State print @retstrResult:
Chennai;Madurai;Coimbatore
Please check this link to Transpose Columns to Rows in Sql Server 2005
I log SSIS package execution but want to transform the table into a xtab to allow calculation of stats. I have data like process event eventDt dayEvent timeEvent eoo start 2009-08-16 03:30:08.843 08/16/2009 03:30:08:843 eoo stop 2009-08-16 03:37:42.887 08/16/2009 03:37:42:887 eoo start 2009-08-18 03:30:12.907 08/18/2009 03:30:12:907 eoo stop 2009-08-18 03:57:55.090 08/18/2009 03:57:55:090 eoo start 2009-08-20 03:30:12.533 08/20/2009 03:30:12:533 eoo stop 2009-08-20 03:53:22.613 08/20/2009 03:53:22:613 but want it as process start stop eoo 2009-08-16 03:30:08.843 2009-08-16 03:37:42.887 Any suggestions?
Chivtya
Great Thought Thanks works great