Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

change .dat to a .txt

Status
Not open for further replies.

balistikb

Technical User
Nov 12, 2002
177
0
0
US
Is it possible to change a .dat file to a .txt file in a dts? I tried but it doesn't recognise .dat.
 
If you are just trying to change the name of an existing .dat file to a .txt file, you could use the xp_CmdShell option as in ...

EXEC xp_CmdShell 'Ren C:\Myfile.dat C:\Myfile.txt'

Thanks

J. Kusch
 
Can you explain what that command is doing? Break it down so I can understand.
Thanks, I am new to this.
 
It is shelling out to DOS and running a RENAME command on your file. It is changing it from a .DAT to a .TXT

Full command should be ...

EXEC master..xp_CmdShell 'Ren C:\Myfile.dat C:\Myfile.txt'

You would of course change the Path and file name to correspond to your file name.

Wrap this in a "Execute SQL Task" object w/in your DTS package and you are good to go!

Thanks

J. Kusch
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top