I am trying to select data from one field and updating it into a different field thats in the same row. But i dont really know where to begin since im new to SQL, i know i got to start with a select but how to i then use that to update into the other field ?
update tblFPPets
set AcctNum = LicenseNum, LicenseNum = null
where DateLicenseExpires < getdate() and OwnerID_FK = 8
but when i try to do it on the entire database like
update tblFPPets
set AcctNum = LicenseNum, LicenseNum = null
where DateLicenseExpires < getdate()
i get this error
Server: Msg 2627, Level 14, State 2, Line 1
Violation of UNIQUE KEY constraint 'UQ__tblFPPets__0880433F'. Cannot insert duplicate key in object 'tblFPPets'.
The statement has been terminated.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.