Here is the script:
DECLARE @Filename varchar(10)
SET @Filename = 'TubeSta_cycle_log.txt'
UPDATE Torque.LastUpdate
SET LastUpdated = getDate()
WHERE Station = substring(@Filename,1,CHARINDEX('_', @FileName)-1)
The 'Execute SQL Task Editor' executes with NO errors but doesn't update the table.
Well I see a few possible issues with this.
DECLARE @Filename varchar(10)
SET @Filename = 'TubeSta_cycle_log.txt'
The value added to the parameter is TubeSta_cy
so your filename is being truncated.
If you run in SSMS:
select substring(@Filename,1,CHARINDEX('_', @FileName)-1)
The result is TubeSta
, do you have a record with that value?
It seems like you need to expand your varchar(50)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.