Friday, March 9, 2012

DTS ActiveX BCP file manipulation

Does anyone know the best way to handle this type of situation?

A file coming into a directory based on the date filename042707
I use the fileexist stored procedure to check for the existence.
I use xp_cmdshell(sp)... stored procedure to rename the file so that
it just has filename instead of the date... I can not use
variables within the xp_cmdshell to replace the date...
everyday the filename would change to filename042807,filename042907 etc...

Basically I know how to copy the file to another directory if it exists...
then I want to strip the right 8 characters off... rename just to that
but with the rename i have to know what the file will be named for that day ...
excuse the grammar just somewhat tired...
any suggestions... please thanks time for sleep"DTS ActiveX BCP file manipulation"

what on earth are you doing with ActiveX in SQL Server?|||not sure where r u facing problem

I can not use variables within the xp_cmdshell to replace the date...

u can use variables withing xp_cmdshell like below

declare @.cmd varchar(100)
set @.cmd = 'ren d:\file042807.xls file' + replace(convert(varchar ,getdate(),1),'/','') + '.xls'
exec master..xp_cmdshell @.cmd

what on earth are you doing with ActiveX in SQL Server?

talking about ActiveX of DTS...

No comments:

Post a Comment