Overblog Follow this blog
Edit post Administration Create my blog
Balavardhan Reddy Narani

Update Column Name Set values to Column of table in Sqlserver

March 7 2009 , Written by Balavardhan Published on #SQL Server2005

Here by i am provinding a query to update a Column name of table and set teh new values into that column and we can view the Old column and values and Updated column name and newly set value of the column.


Update < TableName>
Set <<Column Name>> = <<Value>>
OutPut
Deleted.<<Column Name>> 'Old',
Inserted.<<Column Name>> 'New'
where <<column>> = <<value>>


Ex :


Create table #temp(id int,Names Varchar(50)
Insert into #temp(1,'Hi')

update #temp
set Names = 'Hi World'
OUTPUT
deleted.Names 'Old'
, inserted.Names 'New'
where id = 1



Output It will display Old Clomn and its values of the table and Updated Column name and newly set values into  column
--
Old              New
-------         ---------
Hi              Hi World

Share this post

Repost 0

Comment on this post