Solved

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

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

Free eBook: Backup on AWS

Everything you need to know about backup and disaster recovery with AWS, for FREE!

Question has a verified solution.

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

Suggested Solutions

Introduction In my previous article (http://www.experts-exchange.com/Microsoft/Development/MS-SQL-Server/SSIS/A_9150-Loading-XML-Using-SSIS.html) I showed you how the XML Source component can be used to load XML files into a SQL Server database, us…
This article explains how to reset the password of the sa account on a Microsoft SQL Server.  The steps in this article work in SQL 2005, 2008, 2008 R2, 2012, 2014 and 2016.
This video shows, step by step, how to configure Oracle Heterogeneous Services via the Generic Gateway Agent in order to make a connection from an Oracle session and access a remote SQL Server database table.
Using examples as well as descriptions, and references to Books Online, show the documentation available for datatypes, explain the available data types and show how data can be passed into and out of variables.

749 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