Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
Aeolos
Starting Member
1 Post |
Posted - 2012-01-21 : 09:13:00
|
Hi, I have wrote a simple procedure to write the contents of a CSV file to a Table. My problem is if I specify the file location the procedure saves and works fine. If I replace the file name with a parameter I get an error when saving the procedure:Incorrect syntax near '@Param1'.Incorrect syntax near the keyword 'with'. If this statement is a common table expression, an xmlnamespaces clause or a change tracking context clause, the previous statement must be terminated with a semicolon.Working Procedure that will save (filepath specified)CREATE PROCEDURE TestProca( @Param1 varchar(50) = NULL)ASBULKINSERT CSVImportFROM 'd:\csvtest.csv'WITH(FIELDTERMINATOR = ',',ROWTERMINATOR = '\n')GOWorking Procedure that will save (filepath as parameter)CREATE PROCEDURE TestProca( @Param1 varchar(50) = NULL)ASBULKINSERT CSVImportFROM @Param1WITH(FIELDTERMINATOR = ',',ROWTERMINATOR = '\n')GOCan anyone advise, thanks in advanceAeolos |
|
webfred
Master Smack Fu Yak Hacker
8781 Posts |
|
|
|
|