Change the SSRS file name by subscription (automatically)
DECLARE @MMYYYY NVARCHAR(60),
@posI INT,
@posF INT,
@File VARCHAR(60)
--// Format the FileName
SET @MMYYYY = Upper(LEFT(Datename(month, Getdate()), 3)
+ Datename(year, Getdate()))
SET @File = 'Custom Fleet Sold (RB)_';
WITH ssrs
AS (SELECT Param = CONVERT(VARCHAR(max), extensionsettings),
posI = Charindex(@File, extensionsettings)
+ Len(@File),
posF = Len(@MMYYYY),
subscriptionid
FROM dbo.subscriptions
WHERE subscriptionid = 'FA3A7FF7-8B7D-496F-BB4B-531568458E93')
UPDATE Sub
SET ExtensionSettings = Replace(Param, ( @File + Substring(Param, posI, posF)
), (
@File + @MMYYYY ))
FROM dbo.subscriptions Sub
INNER JOIN ssrs
ON ssrs.subscriptionid = Sub.subscriptionid