October 20, 2011 at 10:33 am
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 @sql VARCHAR(255)
DECLARE @path VARCHAR(255)
DECLARE @filename VARCHAR(255)
SET @path = 'C:\something\'
SET @filename = 'something.csv'
SET @sql = 'BULK INSERT dbo.Plans FROM ''' + @path + @filename + ''' '
+ ' WITH (
FIELDTERMINATOR = '','',
ROWTERMINATOR = '''',
FIRSTROW = 2
) '
PRINT @sql
--EXEC (sql)
October 20, 2011 at 10:40 am
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.
Lowell
Viewing 2 posts - 1 through 1 (of 1 total)
You must be logged in to reply to this topic. Login to reply