Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Database > SQL Language
|
SQL Language SQL Language discussions not specific to a particular RDBMS program or vendor.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the SQL Language section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old December 30th, 2004, 06:54 AM
Registered User
 
Join Date: Oct 2004
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Default BULK INSERT PROBLEM

I have a problem using the BULK INSERT statement in a script.
The script looks like
  BULK INSERT xxxx from 'C:\TMP\yyyy.txt'
    with (FieldTerminator = ' ') ...

My problem is that the ASCII file have to be placed on the server
folder c:\tmp.
I would like to run the script from the network (from a Workstation)
placing the ascii file in a folder not in server.
Is it possible ?


 
Old December 30th, 2004, 10:44 AM
Friend of Wrox
 
Join Date: Nov 2003
Posts: 625
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to jemacc
Default

Do you mean before you place the file in the c:\temp it must exists?

and if it does not exists create it?

Jaime E. Maccou
 
Old December 30th, 2004, 11:12 AM
Friend of Wrox
 
Join Date: Nov 2003
Posts: 625
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to jemacc
Default

you can simple create a batch file that copies files from your workstation to the server folders

Code:
rem copy files from your work station
copy \\<your workstationname>\c$\folder\\yyyy.txt \
keep in mind that the account you use must have permission to read/write to the server folder.

you can also use xp_cmdshell

Code:
USE master
EXEC xp_cmdshell 'copy c:\tmp\yyyy.txt \\server\folder\', 
   NO_OUTPUT
Jaime E. Maccou
 
Old January 3rd, 2005, 09:18 AM
Registered User
 
Join Date: Jan 2005
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to greenash Send a message via Yahoo to greenash
Default

A simple suggestion.
You can share the TMP folder on the Server and use the UNC path in the script as '\\ServerName\TMP\yyyy.txt'
Hope this helps.





Similar Threads
Thread Thread Starter Forum Replies Last Post
Chapter 3 - Bulk Insert Example Problem. AP BOOK: Professional SQL Server 2005 Integration Services ISBN: 0-7645-8435-9 4 February 5th, 2009 04:50 PM
Bulk Insert Problem starnet SQL Server 2005 5 April 17th, 2007 08:34 AM
hi problem on bulk insert command karthikc85 SQL Server ASP 1 November 8th, 2006 04:22 AM
Bulk Insert Problem pseudo SQL Server 2000 2 October 4th, 2006 06:48 AM
Problem with Bulk Insert starnet SQL Server 2000 1 September 13th, 2006 08:29 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.