Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Curious if it is possible to.... 3

Status
Not open for further replies.

Webkins

Programmer
Dec 11, 2008
118
US
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.

Thank you for any and all assistance.
 
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).

I found this Googling for your answer:
Copy / synchronise directories / folders

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...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top