python ruby-programming-language Smalltalk Vue.js Knockoutjs TypeScript JavaScript, OOPs JavaScript Angular 8,7,6,5,4 and 2 Interview Questions and Answers Angular 8,7,6,5,4 and 2 Interview Questions and Answers Angular 4 Angular 2 AngularJs 1.x NodeJs Perl Programming R Programming RequireJs Rust Programming Backbonejs closure programming language go-programming-language kotlin-programming-language
Update a table using JOIN in SQL Server?

Update a table using JOIN in SQL Server?

Hello everyone, I am going to share the query to update a table using JOIN and without in SQL Server.

            Table of Contents.
1.       Query for update a table using INNER JOIN.
2.       Query for update a table without JOIN.

The query detail as given below.

Query for update a table using INNER JOIN. i.e.

UPDATE UR SET UR.IsDeleted = 1
     FROM [DBO].[USERROLE] AS UR
     INNER JOIN [DBO].[USERS] AS U  ON UR.UserID = U.UserID
WHERE UR.UserID = 1001
        AND  U.UserID = 1001

Query for update a table without JOIN. i.e.

UPDATE U 
SET U.ISDELETED=0
FROM [DBO].[USERROLE] AS U
WHERE U.USERID=1023

For more detail go to link.



ANIL SINGH

Hi there! Welcome to my blog. My name is Anil Singh. I'm a author of this blog. For more detail about me, kindly refer to this link..
My Blogs - http://code-sample.com and http://code-sample.xyz
My Books - Interview Questions and Answers Books- Get Your Book in 15+ Digital Stores Worldwide..

You Might Also Like
www.code-sample.com/. Powered by Blogger.
ASK Questions