Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase ««12

Bulk Insert Expand / Collapse
Author
Message
Posted Tuesday, April 30, 2002 11:16 AM
SSC-Enthusiastic

SSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-Enthusiastic

Group: General Forum Members
Last Login: Friday, December 13, 2013 12:39 PM
Points: 155, Visits: 132
Use Exec stmt
Exec(@some_string )





Give me a fish, you feed me for a day! Teach me to fish, you feed me for a life time.
Post #30278
Posted Thursday, September 26, 2002 1:05 PM
SSC Journeyman

SSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC Journeyman

Group: General Forum Members
Last Login: Tuesday, October 23, 2012 12:55 PM
Points: 86, Visits: 9
Problem with quotes in the Bulk Insert - normally I use what you suggested

BULK INSERT temp FROM ''' (plus) @file (plus) '''

But in this case - my actual filename has quotes around it. It comes from a mainframe and for whatever reason thats the way the frame creates the filenames.

I tried using the "normal" way - but I get the following error:

Server: Msg 170, Level 15, State 1, Line 2
Line 2: Incorrect syntax near 'ECM'.
(the filename is 'ECM.DM.LIST.0001000037.TEST' (quotes and all)

The actual syntax of the bulk insert (at run-time) is:

BULK INSERT temploadswbt FROM '\\Chicagofs\Ameritech\Sbc\'ECM.DM.LIST.0001000037.TEST''
WITH (
FORMATFILE = 'g:\sbcdata\swbtpb_new.fmt' )

anyone have any ideas? Thanks!!



Post #30279
Posted Thursday, September 26, 2002 2:47 PM
SSC-Enthusiastic

SSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-Enthusiastic

Group: General Forum Members
Last Login: Thursday, October 28, 2010 11:22 AM
Points: 152, Visits: 7
replace(filename, '"', '')




Post #30280
Posted Thursday, September 26, 2002 3:23 PM
SSC Journeyman

SSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC Journeyman

Group: General Forum Members
Last Login: Tuesday, October 23, 2012 12:55 PM
Points: 86, Visits: 9
I am referencing an actual file that has quotes in the filename - if I take the quotes out of the variable holding the filename - it won't match the actual filename


Post #30281
Posted Thursday, September 26, 2002 3:38 PM
Say Hey Kid

Say Hey KidSay Hey KidSay Hey KidSay Hey KidSay Hey KidSay Hey KidSay Hey KidSay Hey Kid

Group: General Forum Members
Last Login: Wednesday, May 30, 2007 4:59 PM
Points: 672, Visits: 1
Need another ' at the end try

Select '\\Chicagofs\Ameritech\Sbc\''ECM.DM.LIST.0001000037.TEST'''
and you get

\\Chicagofs\Ameritech\Sbc\'ECM.DM.LIST.0001000037.TEST'
which is what T-SQL will be using internally.




Post #30282
« Prev Topic | Next Topic »

Add to briefcase ««12

Permissions Expand / Collapse