Friday, April 17, 2009

How to Perform Update Operation With Join in SQL server.

How to Perform Update Operation With Join in SQL server.

How to Perform Update Operation With Join in SQL server.

we can Update any tables data in conjuction with join operation. In case when you have to Update multiple records without where condition and based on some Critearea you can use join with update statement. I have a XML string and want to update all records whose ID contains in this XML string.

Declare @XML xml
set @XML='11112'
Update User_mst set [Name]='Haresh,Herry' from
(
select ParamValues.[Name].value('.','VARCHAR(200)') as [Name]
FROM @XML.nodes('/Project/Id') as ParamValues([Name])
) as N inner join User_mst usr on usr.Id=N.[Name]


Thanks.

No comments:

Post a Comment

Comments posted on ASP.Net Ajax Tutorials Blog are moderated and will be approved only if they are on-topic and not abusive. Please email me or my team for tech-support or blogging related questions. Avoid including website URLs in your comments - Thanks Author