Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Using quotes in a string
Message
De
18/10/2012 14:05:31
 
 
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Syntaxe SQL
Versions des environnements
SQL Server:
SQL Server 2008
Divers
Thread ID:
01555242
Message ID:
01555268
Vues:
36
(Update) Got it to work by moving the file to a network drive and UNC'ing to it. Now the question becomes, how do I UNC a local hard drive? The file will either be coming off a local harddrive or off an external hard drive 9.99 times out of 10
(End Update)


The location is on the local hard drive.
I have no clue.
Bulk Insert qryICECLExport
    from "c:\download\dropbox\cat\qryICECLExport1015.csv" with (FieldTerminator = ',', RowTerminator = '\n')
Msg 4861, Level 16, State 1, Line 1
Cannot bulk load because the file "c:\download\dropbox\cat\qryICECLExport1015.csv" could not be opened. 
Operating system error code 3(The system cannot find the path specified.).
So, yeah...it looks like a rights issue, maybe.


>It is a path on the server or your local path? Does the server account you're running it from has rights to this file?
>Also please post the exact error message.
>
>>Ok, we're getting closer - the quotes are there - but now it's telling me it can't open the .csv file and the file IS there, it's not locked, nothing else has it open and I can open it in Notepad with no problem.
>>
>> (Sigh) I'm going to lunch and I'll take this fight back up when I get back. Perhaps a bolt of brilliance will hit me whilst I'm out....or, someone here will go "You're problem's right THERE" while pointing metaphorically and I'll feel like an idiot.
>>Either way, I gotta get this to work...
>>
>>
>>>Try
>>>
>>>declare @filename nvarchar(50), @BulkCmd nvarchar(200)
>>>Set @filename = 'c:\download\dropbox\cat\qryICECLExport.csv'
>>>set @BulkCmd = 'Bulk Insert qryICECLExport
>>>    from " ' + @filename  + 
>>>    '" with (FieldTerminator = '','', RowTerminator = ''\n'')'
>>>print @BulkCmd
>>>exec(@BulkCmd)
>>>
>>>In other words, try putting file name in double quotes.
"You don't manage people. You manage things - people you lead" Adm. Grace Hopper
Pflugerville, between a Rock and a Weird Place
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform