forums.sybase.com
2008-05-19 15:56:32 UTC
People
I want to create a dump file whose filename contains the current date and
time, so I've done this (in 12.5.4):
declare @fdate varchar(20)
declare @execstring varchar(255)
set @fdate = convert (varchar,getdate(), 112) + convert(varchar,
datepart(hh,getdate())) + convert(varchar,datepart(mi,getdate())) +
convert(varchar,datepart(ss,getdate()))
set @execstring = '"c:\sybdumps\jftestdb_trandump_' + @fdate + '.dmp"'
dump tran jftestdb to @execstring
The dump fails with this:
Backup Server: 4.141.2.40: [7] The 'CreateFile' call failed for device
'C:\WINDOWS\system32\"c:\sybdumps\jftestdb_trandump_2008051916488.dmp"' with
error number 123 (The filename, directory name, or volume label syntax is
incorrect). Refer to your operating system documentation for further
details.
Server Message: Number 8009, Severity 16
As you can see, the string ''C:\WINDOWS\system32\' is being inserted before
my string and making the backup fail. I tried 'exec @variable' with
@variable containing the full execution command, but that fails because dump
tran isn't permitted to be exec'd from a variable.
Can anybody explain why rubbish is inserted in my string or advise what
other method is available for creating a transaction dump file containing
the date and time in its name?
Many thanks in advance
Jacques
I want to create a dump file whose filename contains the current date and
time, so I've done this (in 12.5.4):
declare @fdate varchar(20)
declare @execstring varchar(255)
set @fdate = convert (varchar,getdate(), 112) + convert(varchar,
datepart(hh,getdate())) + convert(varchar,datepart(mi,getdate())) +
convert(varchar,datepart(ss,getdate()))
set @execstring = '"c:\sybdumps\jftestdb_trandump_' + @fdate + '.dmp"'
dump tran jftestdb to @execstring
The dump fails with this:
Backup Server: 4.141.2.40: [7] The 'CreateFile' call failed for device
'C:\WINDOWS\system32\"c:\sybdumps\jftestdb_trandump_2008051916488.dmp"' with
error number 123 (The filename, directory name, or volume label syntax is
incorrect). Refer to your operating system documentation for further
details.
Server Message: Number 8009, Severity 16
As you can see, the string ''C:\WINDOWS\system32\' is being inserted before
my string and making the backup fail. I tried 'exec @variable' with
@variable containing the full execution command, but that fails because dump
tran isn't permitted to be exec'd from a variable.
Can anybody explain why rubbish is inserted in my string or advise what
other method is available for creating a transaction dump file containing
the date and time in its name?
Many thanks in advance
Jacques