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

Posted on 2007-11-28
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 ?
Question by:Auerelio Vasquez
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2

Author Comment

by:Auerelio Vasquez
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.....
LVL 31

Expert Comment

by:James Murrell
ID: 20367776

Accepted Solution

Auerelio Vasquez earned 0 total points
ID: 20367855
where is the part about xp_cmd shell in this blog ?

Author Comment

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

Featured Post

Revamp Your Training Process

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action.

Question has a verified solution.

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

Slowly Changing Dimension Transformation component in data task flow is very useful for us to manage and control how data changes in SSIS.
Recently we ran in to an issue while running some SQL jobs where we were trying to process the cubes.  We got an error saying failure stating 'NT SERVICE\SQLSERVERAGENT does not have access to Analysis Services. So this is a way to automate that wit…
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
Via a live example, show how to backup a database, simulate a failure backup the tail of the database transaction log and perform the restore.

691 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