I am trying to import a csv file dynamically.
This works:
BULK
INSERT #CSV
FROM 'C:\Users\MyName\Desktop\Players.csv'
WITH
(
FIELDTERMINATOR = ',',
ROWTERMINATOR = '\n'
)
I would like to change it to be with a @path parameter like that:
DECLARE @path NVARCHAR(4000) = 'C:\Users\MyName\Desktop\Players.csv';
BULK
INSERT #CSV
FROM @path
WITH
(
FIELDTERMINATOR = ',',
ROWTERMINATOR = '\n'
)
But this does not compiles.
How could I do that?
Thanks in advance.