I'm a DBA and I've been using UE for about a decade now. For most of that time I've used the Template feature to create headers for my SQL Scripts. After upgrading recently to 17.10.0.1015 one of the Template standards, [FILE_NAME] stopped working properly. Instead of displaying just the "root" of a file's name like it always had, it started including the file's extension.
For example, say I have a file called SQLDocumentor.sql and a Template called SQLHdr (see example below). One of the Template special strings I use in that header is [FILE_NAME]. When the template is executed [FILE_NAME] should translate to "SQLDocumentor" only. That's been the result for years now. Instead, with this version, [FILE_NAME] is returning SQLDocumentor.sql.
Is this by design? If so, how do I downgrade?
Here's that Header Template:
/******
[FILE_NAME]
Create Date: [DATE_USER]MM'/'dd'/'yyyy[DATE_USER_END] [TIME_USER]hh':'mm':'ss tt[TIME_USER_END]
Last Update: [DATE_USER]MM'/'dd'/'yyyy[DATE_USER_END] [TIME_USER]hh':'mm':'ss tt[TIME_USER_END]
Desc:
[FULL_FILE_NAME]
******/
set nocount on
DECLARE @fileDateShort nvarchar(20)
DECLARE @instance nvarchar(100)
SELECT @fileDateShort = replace(convert(varchar, getdate(),101),'/','-')
SELECT @instance = case
when CONVERT(varchar(50),SERVERPROPERTY('InstanceName')) is NULL
then @@SERVERNAME
else CONVERT(varchar(50),SERVERPROPERTY('InstanceName'))
END
PRINT 'Instance name: ' + @instance + CHAR(10) +
'Current Database: ' + db_name() + CHAR(10) +
'C:\Logs\' + @instance + '-[FILE_NAME]-' + @fileDateShort + '.log' + CHAR(10) +
'DATE/TIME: ' + CONVERT(varchar, GETDATE(),120) + CHAR(13) ;
set nocount off
GO
And here's what its returning. The text in bold red should read JWS-ServerTraces and not JWS-ServerTraces.sql:
/******
JWS-ServerTraces.sql
Create Date: 08/31/2011 08:45:18 AM
Last Update: 08/31/2011 08:45:18 AM
Desc:
C:\sqlsvr\Projects\JWS\Tuning\JWS-ServerTraces.sql
******/
set nocount on
DECLARE @fileDateShort nvarchar(20)
DECLARE @instance nvarchar(100)
SELECT @fileDateShort = replace(convert(varchar, getdate(),101),'/','-')
SELECT @instance = case
when CONVERT(varchar(50),SERVERPROPERTY('InstanceName')) is NULL
then @@SERVERNAME
else CONVERT(varchar(50),SERVERPROPERTY('InstanceName'))
END
PRINT 'Instance name: ' + @instance + CHAR(10) +
'Current Database: ' + db_name() + CHAR(10) +
'C:\Logs\' + @instance + '-JWS-ServerTraces.sql-' + @fileDateShort + '.log' + CHAR(10) +
'DATE/TIME: ' + CONVERT(varchar, GETDATE(),120) + CHAR(13) ;
set nocount off
GO
For example, say I have a file called SQLDocumentor.sql and a Template called SQLHdr (see example below). One of the Template special strings I use in that header is [FILE_NAME]. When the template is executed [FILE_NAME] should translate to "SQLDocumentor" only. That's been the result for years now. Instead, with this version, [FILE_NAME] is returning SQLDocumentor.sql.
Is this by design? If so, how do I downgrade?
Here's that Header Template:
/******
[FILE_NAME]
Create Date: [DATE_USER]MM'/'dd'/'yyyy[DATE_USER_END] [TIME_USER]hh':'mm':'ss tt[TIME_USER_END]
Last Update: [DATE_USER]MM'/'dd'/'yyyy[DATE_USER_END] [TIME_USER]hh':'mm':'ss tt[TIME_USER_END]
Desc:
[FULL_FILE_NAME]
******/
set nocount on
DECLARE @fileDateShort nvarchar(20)
DECLARE @instance nvarchar(100)
SELECT @fileDateShort = replace(convert(varchar, getdate(),101),'/','-')
SELECT @instance = case
when CONVERT(varchar(50),SERVERPROPERTY('InstanceName')) is NULL
then @@SERVERNAME
else CONVERT(varchar(50),SERVERPROPERTY('InstanceName'))
END
PRINT 'Instance name: ' + @instance + CHAR(10) +
'Current Database: ' + db_name() + CHAR(10) +
'C:\Logs\' + @instance + '-[FILE_NAME]-' + @fileDateShort + '.log' + CHAR(10) +
'DATE/TIME: ' + CONVERT(varchar, GETDATE(),120) + CHAR(13) ;
set nocount off
GO
And here's what its returning. The text in bold red should read JWS-ServerTraces and not JWS-ServerTraces.sql:
/******
JWS-ServerTraces.sql
Create Date: 08/31/2011 08:45:18 AM
Last Update: 08/31/2011 08:45:18 AM
Desc:
C:\sqlsvr\Projects\JWS\Tuning\JWS-ServerTraces.sql
******/
set nocount on
DECLARE @fileDateShort nvarchar(20)
DECLARE @instance nvarchar(100)
SELECT @fileDateShort = replace(convert(varchar, getdate(),101),'/','-')
SELECT @instance = case
when CONVERT(varchar(50),SERVERPROPERTY('InstanceName')) is NULL
then @@SERVERNAME
else CONVERT(varchar(50),SERVERPROPERTY('InstanceName'))
END
PRINT 'Instance name: ' + @instance + CHAR(10) +
'Current Database: ' + db_name() + CHAR(10) +
'C:\Logs\' + @instance + '-JWS-ServerTraces.sql-' + @fileDateShort + '.log' + CHAR(10) +
'DATE/TIME: ' + CONVERT(varchar, GETDATE(),120) + CHAR(13) ;
set nocount off
GO