Do you work with and analyze data? Enroll in October's Course of the Month for 7+ hours of SQL training, allowing you to quickly and efficiently store or retrieve data. It's free for Premium Members, Team Accounts, and Qualified Experts!
declare @ErrorMessage varchar(4000) = '' BEGIN TRAN trn1 BEGIN TRY update p set p.Professional_Id = s.Destination_Professional_Id from tblPhys p, dbo.Prof s where p.Professional_Id = s.Source_Professional_Id and s.Source_Professional_Id IS NOT NULL and EXISTS (SELECT * FROM dbo.tblPhys AS tp WHERE tp.Professional_Id = s.Destination_Professional_Id AND tp.PhysicianId = p.PhysicianId) COMMIT TRAN trn1 END TRY BEGIN CATCH IF @@TRANCOUNT > 0 ROLLBACK TRAN trn1 Set @ErrorMessage = @ErrorMessage + ' Update Failed for ProfesstionalId from S: ' + convert(varchar(20), s.Destination_Professional_Id) + Error_message() + ' failed at trn1' END CATCH
Add your voice to the tech community where 5M+ people just like you are talking about what matters.
Join the community of 500,000 technology professionals and ask your questions.