0
SELECT rollID 
FROM [dbo].[dbo_Roll] a
  INNER JOIN [evt_Building Permits] b
    ON LEFT(a.rollnumber, LEN(a.rollnumber)-4) = b.rollnumber COLLATE DATABASE_DEFAULT

And I want to update the result to this table [evt_Building Permits].roll_id = [dbo].[dbo_Roll].rollID?

How can I attain this?

3 Answers 3

1

Try this

UPDATE b
SET b.roll_id = a.rollID
FROM 
    [dbo].[dbo_Roll] a
  INNER JOIN 
    [evt_Building Permits] b
  ON LEFT(a.rollnumber, LEN(a.rollnumber)-4) = b.rollnumber COLLATE DATABASE_DEFAULT
Sign up to request clarification or add additional context in comments.

Comments

0

Something like this.

update b
set rollID = a.rollID
from [dbo].[dbo_Roll] a
inner join [evt_Building Permits] b
on LEFT(a.rollnumber, LEN(a.rollnumber)-4) = b.rollnumber COLLATE DATABASE_DEFAULT

Comments

0

Try this syntax:

update b
set b.roll_id = a.rollID
from [dbo].[dbo_Roll] a
inner join [evt_Building Permits] b
on LEFT(a.rollnumber, LEN(a.rollnumber)-4) = b.rollnumber COLLATE DATABASE_DEFAULT

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.