Solved

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

Posted on 2007-11-28
5
1,186 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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When you hear the word proxy, you may become apprehensive. This article will help you to understand Proxy and when it is useful. Let's talk Proxy for SQL Server. (Not in terms of Internet access.) Typically, you'll run into this type of problem w…
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…
This videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function
Via a live example, show how to set up a backup for SQL Server using a Maintenance Plan and how to schedule the job into SQL Server Agent.

829 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