March 8, 2013 at 11:42 am
Hi All,
can any one help on below query
declare @tbl table (TBLID int identity(1,1),ID int,patientName varchar(10),age int,city varchar(100),Mobile int)
insert @tbl(ID,patientName,age,city,Mobile) select 1,'Ramesh',20,'HYD',12345678 union all
select 1,'Ramesh new',20,'HYDERABAD ' ,12345678 union all
select 1,'Ramesh new',20,'HYDERABAD ' ,87654321
select * from @tbl
TBLID ID patientName age city Mobile
1 1 Ramesh 20 HYD 12345678
2 1 Ramesh 24 HYD 12345678
3 1 Ramesh new 20 HYDERABAD 87654321
i want output as mentioned below format which columns data got changed
Columns OLDDATA NEWDATA
patientName Ramesh Ramesh new
City HYD HYDERABAD
Mobile 12345678 87654321
can any one help on this
March 8, 2013 at 12:37 pm
Duplicate post. Direct replies here. http://www.sqlservercentral.com/Forums/Topic1428706-391-1.aspx
_______________________________________________________________
Need help? Help us help you.
Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.
Need to split a string? Try Jeff Modens splitter http://www.sqlservercentral.com/articles/Tally+Table/72993/.
Cross Tabs and Pivots, Part 1 – Converting Rows to Columns - http://www.sqlservercentral.com/articles/T-SQL/63681/
Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs - http://www.sqlservercentral.com/articles/Crosstab/65048/
Understanding and Using APPLY (Part 1) - http://www.sqlservercentral.com/articles/APPLY/69953/
Understanding and Using APPLY (Part 2) - http://www.sqlservercentral.com/articles/APPLY/69954/
Viewing 2 posts - 1 through 1 (of 1 total)
You must be logged in to reply to this topic. Login to reply