Solved

Get a Filename and put into a variable in SQL Server Query Analyzer

Posted on 2007-11-28
5
1,172 Views
Last Modified: 2012-05-05
Is there a way to get a filename from the windows directory and put that name into a variable using xp_cmdshell commands ?

ex. c:\folder\test.csv

I just want the part of the pat that has test.csv. is it possible to collect that information in a stored procedure ?
0
Comment
Question by:basile
  • 3
  • 2
5 Comments
 
LVL 31

Expert Comment

by:James Murrell
ID: 20367627
0
 
LVL 1

Author Comment

by:basile
ID: 20367675
That solution is a little more than i need. I really need to go and find out what a filename is in a directory, and pass it to the variable.....
0
 
LVL 31

Expert Comment

by:James Murrell
ID: 20367776
0
 
LVL 1

Accepted Solution

by:
basile earned 0 total points
ID: 20367855
where is the part about xp_cmd shell in this blog ?
0
 
LVL 1

Author Comment

by:basile
ID: 20414513
is there anything else you can suggest ? these weren't helpful
0

Featured Post

Get up to 2TB FREE CLOUD per backup license!

An exclusive Black Friday offer just for Expert Exchange audience! Buy any of our top-rated backup solutions & get up to 2TB free cloud per system! Perform local & cloud backup in the same step, and restore instantly—anytime, anywhere. Grab this deal now before it disappears!

Join & Write a Comment

Ever needed a SQL 2008 Database replicated/mirrored/log shipped on another server but you can't take the downtime inflicted by initial snapshot or disconnect while T-logs are restored or mirror applied? You can use SQL Server Initialize from Backup…
Ever wondered why sometimes your SQL Server is slow or unresponsive with connections spiking up but by the time you go in, all is well? The following article will show you how to install and configure a SQL job that will send you email alerts includ…
Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…
Via a live example, show how to extract insert data into a SQL Server database table using the Import/Export option and Bulk Insert.

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now