M
M
Michael Vasyukov2017-11-27 07:54:20
Microsoft SQL Server Management Studio
Michael Vasyukov, 2017-11-27 07:54:20

Unable to compose correct UPDATE ms sql query?

Hi all! I can’t deal with this problem:
There is an Import table (full):
5a1b996082b38900921733.png
I need to copy columns from it (FirstName, LastName, Email) to the BolTest table (empty):
5a1b99d2292fd382446252.png
I try to make a copy with this query:

update BolTest
set
BolTest.FirstName=Import.FirstName,
BolTest.LastName=Import.LastName,
BolTest.Email=Import.Email
from BolTest inner join Import
on BolTest.StaffId=Import.StaffId

I execute the request, it writes in the message line "Lines processed: 0", it seems to me that the problem is in the condition line "on BolTest.StaffId=Import.StaffId", and I really don’t know what the reason is, I’m very familiar with sql. Please point out my mistake, what am I doing wrong?
PS Thank you very much!

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexey, 2017-11-27
@programmer_developer

Update is a change to existing data. If you need to create new data use Insert

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question