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

Posted on 2007-11-28
Medium Priority
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

Want to be a Web Developer? Get Certified Today!

Enroll in the Certified Web Development Professional course package to learn HTML, Javascript, and PHP. Build a solid foundation to work toward your dream job!

Question has a verified solution.

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

In the first part of this tutorial we will cover the prerequisites for installing SQL Server vNext on Linux.
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 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…
Viewers will learn how to use the UPDATE and DELETE statements to change or remove existing data from their tables. Make a table: Update a specific column given a specific row using the UPDATE statement: Remove a set of values using the DELETE s…
Suggested Courses

765 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