0

I'm new and just starting out at creating databases so I apologise if noob question.

What I am trying to do is update my Staff table to show that "Sarah Avon" has married and her new last name is changed to "Tyne"

enter image description here

I have used in SQL view the following code to do this.

enter image description here

However when running the query it leaves all cells blank as shown below. What I wish to happen is Sarah’s last name is updated from Avon to Tyne.

enter image description here

Can anyone bring some light on the subject as to where I have gone wrong?

Thank you all for your time.

1

I don't know much of T-SQL but I believe that to compare strings you need the logical operator AND. Try this:

UPDATE StaffCopy SET StaffCopy.LastName=IIF(([LastName]='Avon' AND [FirstName]='Sarah'), 'Tyne', [LastName]);

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.