Using MSSql 2000 I was wondering if it is possible to use a SQL stored procedure or better yet to schedule a SQL job to copy and rename files from one computer location to another and what that code would look like.
I believe this is possible, but I could not begin to tell you how. I will defer to the greater SQL powers here in the forum.
But I would like to throw out WHY??? In my opinion, this is probably not something SQL was "optimized" for compared to other programming language sets, such as VB, C#, C++, or probably a few others. C# and VB are both strong in working against the file system, and have a whole set of classes just for this built in....
And the free Express version of each of the named languages above have this capability...
=======================================
People think it must be fun to be a super genius, but they don't realize how hard it is to put up with all the idiots in the world. (Calvin from Calvin And Hobbs)
Robert L. Johnson III
CCNA, CCDA, MCSA, CNA, Net+, A+, CHDP
VB.NET Programmer
I highly agree with mstrmage1768, however, there are a couple of instances that would be nice to copy the file as an 'in process' (move the file after a sucessful import for example).
Looks like it could be modified to execute your needs.
--------------------------------------------------
Bluto: What? Over? Did you say "over"? Nothing is over until we decide it is! Was it over when the Germans bombed Pearl Harbor? No!
Otter: Germans?
Boon: Forget it, he's rolling.
--------------------------------------------------
If you want to access file system in SQL Server 2000 (or do other operation outside of SQL Server), you can generaly use an extended procedure. It is coded in C according to given API (see books online for more information). You can also use SQL Server Agent to run a job with Operating System Command step. In the step, you can run a batch, command file or an application to work with files.
Doing operations external to SQL Server is much easier in SQL Server 2005 or 2008, where you can use a CLR integration and write stored procedures in any .NET language...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.