|
|
|
SSC-Enthusiastic
      
Group: General Forum Members
Last Login: Thursday, February 28, 2013 9:42 AM
Points: 189,
Visits: 509
|
|
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)
|
|
|
|
|
SSChampion
        
Group: General Forum Members
Last Login: Today @ 3:24 PM
Points: 11,605,
Visits: 27,649
|
|
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
--There is no spoon, and there's no default ORDER BY in sql server either. Actually, Common Sense is so rare, it should be considered a Superpower. --my son
|
|
|
|