Click here to monitor SSC
SQLServerCentral is supported by Redgate
Log in  ::  Register  ::  Not logged in
Home       Members    Calendar    Who's On

Add to briefcase

Does SQL Azure Support Bulk Insert from a File? Expand / Collapse
Posted Thursday, October 20, 2011 10:33 AM
SSC Veteran

SSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC Veteran

Group: General Forum Members
Last Login: Friday, October 14, 2016 10:54 AM
Points: 204, Visits: 574
I'm just curious if this would work.

If I connect to SQL Azure using SSMS on my local machine and the C:\something\something.csv is on my local machine.

DECLARE @filename VARCHAR(255)

SET @path = 'C:\something\'
SET @filename = 'something.csv'

SET @sql = 'BULK INSERT dbo.Plans FROM ''' + @path + @filename + ''' '
+ ' WITH (
) '
PRINT @sql
--EXEC (sql)

Post #1193887
Posted Thursday, October 20, 2011 10:40 AM



Group: General Forum Members
Last Login: Today @ 6:53 AM
Points: 14,541, Visits: 38,382
you can use the .NET Frameworks SQLBulkCopy object , and use that to load via bulk copy, but not BULK INSERT command; that requires you to have already organized the data into a DataTable on the client side.

if BULK INSERT were to be possible, the path to the file would be something like \\Your.Inernet.IP\c$\Somefolder\Somefile.csv, so that's not going to work.


help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!
Post #1193890
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse