Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

Query help..... Expand / Collapse
Author
Message
Posted Friday, March 8, 2013 11:42 AM
SSC Rookie

SSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC Rookie

Group: General Forum Members
Last Login: Sunday, April 20, 2014 10:08 PM
Points: 30, Visits: 158
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

Post #1428716
Posted Friday, March 8, 2013 12:37 PM


SSChampion

SSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampion

Group: General Forum Members
Last Login: Yesterday @ 3:16 PM
Points: 13,301, Visits: 12,159
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 Moden's splitter.

Cross Tabs and Pivots, Part 1 – Converting Rows to Columns
Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs
Understanding and Using APPLY (Part 1)
Understanding and Using APPLY (Part 2)
Post #1428737
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse