|
ALTER PROCEDURE Pr_UpdatePoint
(
@ManagerID int,
@departID int,
@StartTime datetime,
@EndTime datetime,
@NowTime datetime,
@TableName varchar (64)
)
AS
declare @sqlcommand varchar (2000)
declare @ sqlcommand2 varchar (2000)
declare @ sqlcommand3 varchar (2000)
declare @ sqlcommand4 varchar (2000)
declare @tempID int
declare @TotalID int --- add spaces here
select @ sqlcommand = 'select' + rtrim (@TotalID) + '= TotalID from' + @ TableName + 'where' + rtrim (@TotalID) + 'is null'
exec (@sqlcommand)
if @TotalID is null
begin
select @ sqlcommand2 = 'insert into [TotalAssess] --- Add spaces here (TotalPoint, StartTime, EndTime, NowTime)
SELECT SUM (RealPoint), '' '+ convert (varchar, @ StartTime, 120) +' '', '' '+ convert (varchar, @ EndTime, 120) +' '', '' '+ convert (varchar, @ NowTime, 120) + '' 'FROM' + @ TableName + 'where TotalID is null'
exec (@ sqlcommand2)
select @ sqlcommand3 = 'UPDATE Assess set TotalID =' + str (@TotalID) + 'where TotalID is null'
exec (@ sqlcommand3)
exec ('update TotalAssess set ManagerID =' + @ ManagerID + ', departID =' + @ departID + ', checkYN = `` not reviewed' 'where TotalID =' + @ tempID + '')
end
--Look at it like this. You have no spaces in two places |
|