Quantcast
Channel: SQLServerCentral » SQL Server 2014 » Development - SQL Server 2014 » Latest topics
Viewing all articles
Browse latest Browse all 3145

inserting distinct values from one table to another table

$
0
0
Hi All, I have the following table[code]Table ACol1 0118F0118R56780118F0118R5678567856780118F0118R[/code]I want to insert only distinct values of Col1 from table A to another tableInsert into TableB ( UserName, ProjectName, processdate, Recordprocess, Comments, RecordProcessExt ) values(@UserName, 'Test Project', getDate(), distinct Col1 from Table1, 'Test Comments', distinct col1+ 'TR' from TableA)How can I accomplish the above. I need to insert distinct column from TableA to RecordProcess and col1+'Tr' to recordprocessExt.I can do it with cursor. I don't know any other way.Also, there are other columns in Table A. I am using sql server 2005.any help will be appreciated.

Viewing all articles
Browse latest Browse all 3145

Trending Articles