Hi everyone, I'm fairly new to sql and right now I am struggling with a script. I am trying to extract data from a normal table into a temporary table, update it in the temporary table, then put it back into the normal table. I'll display my code, let me know what you think, any suggestions are appreciated. Thanks a lot.Create table scripts ( UserID int, UserName char(50), ScrRan char(50), StartTime datetime default getdate(), EndTime datetime);Create table errors ( ID int, UserName char(50), UserLogin char(50), ErrorNumber int, Message char(100), TimeOfError datetime default getdate());declare @error int declare @msg varchar(100) declare @startTime datetime declare @endTime datetimeselect @startTime = getDate()SELECT *INTO #TempFROM PublisherWHERE pub_Name = 'Scene Publishing'UPDATE #TempSET pub_Name = UPPER(pub_Name)SELECT *INTO PublisherFROM #Temp --Begins Error Checking Routine select @error = @@error IF @error <> 0 BEGIN select @msg ='error: ' + convert(varchar(7), @error) + '' insert into errors values (@@SPID, USER, USER_NAME(), @error, @msg, getDate()) END ELSE BEGIN select @endTime = getDate() insert into scripts values (@@SPID, SYSTEM_USER, @startTime, @endTime) END select * from errors select * from scripts
lost and loaded.