-
date file difference in dos command script ?
we are creating script file like below on everyday and I need to find difference between previous script and current script. I can use dos(FC ) command to diffentiate between two file. But How I can differentiate for date itenary file which are generating everyday.
e:\script\des.proc.123000
e:\script\des.function.123000
e:\script\des.table.123000
e:\script\des.proc.122900
e:\script\des.function.122900
e:\script\des.table.122900
Anybody has any suugestion for this issue?.
Thanks,
Ravi
-
Ravi,
Try this. This builds the string you can execute in your xp_cmdshell command, comparing yesterday to today's file:
DECLARE @cmd varchar(200)
set @cmd = 'fc e:\script\des.proc.' + cast(datepart(mm, getdate()) as char(2)) +
cast(datepart(dd, getdate()) as char(2)) + right(cast(datepart(yy, getdate()) as char(4)),2) +
' e:\script\des.proc.' + cast(datepart(mm, DATEADD(day, -1, getdate())) as char(2)) +
cast(datepart(dd, DATEADD(day, -1, getdate())) as char(2)) +
right(cast(datepart(yy, DATEADD(day, -1, getdate())) as char(4)),2)
select @cmd
Jeff
-
Jeff,
Thanks for your good reply.
Your logic is working greate.
I just modified little bit.
The new script as follows
DECLARE @cmd varchar(200)
set @cmd = 'fc /L /N D:\apps\quill\common\sql\scripts\oesd.table.' +
cast(datepart(mm, getdate()) as varchar(2)) +
cast(datepart(dd, getdate()) as varchar(2)) +
'00'+
' D:\apps\quill\common\sql\scripts\oesd.table.' +
cast(datepart(mm, DATEADD(day, -1, getdate())) as varchar(2)) +
cast(datepart(dd, DATEADD(day, -1, getdate())) as varchar(2)) +
'00'
EXEC master..xp_cmdshell @cmd
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
|