July 5, 2006 at 5:48 pm
How to search .BKP and .TRN files using xp_cmdshell (single Query)? Is it possble?
July 6, 2006 at 2:09 am
Please do explain a bit more what you're trying to do.
xp_cmdshell can do what a DOS prompt can do. (it's why it's named as it is)
Can you search those files yourself from a DOS prompt? (for whatever it is you want to search for?)
To avoid misunderstandings, please also clarify what exactly your .BKP and .TRN files are.
File extensions in windows aren't exactly set in stone.
/Kenneth
July 6, 2006 at 6:57 am
Yes, it's possible...
EXEC Master.dbo.xp_CmdShell "DIR d:\path\*.trn,d:\path\*.bkp /s/b"
If you actually want to use the file names, create a table with a nice wide VARCHAR column and do this...
INSERT INTO yourtable (widevarcharcolname)
EXEC Master.dbo.xp_CmdShell "DIR d:\path\*.trn,d:\path\*.bkp /s/b"
There are some undocumented xp calls that can be made , as well. They're great because they don't require SA privs but they also stink because they didn't carry them forward in SQL Server 2005.
Now that I mention that, I think xp_CmdShell was renamed in SQL Server 2005, as well? Anybody know for sure?
--Jeff Moden
Change is inevitable... Change for the better is not.
July 6, 2006 at 7:20 am
Nope still exist albeit disabled by default. And finally the account requirement is documented.
http://msdn2.microsoft.com/en-us/library/ms175046.aspx
Kind regards,
Gift Peddie
Kind regards,
Gift Peddie
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply