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 |
|
AskSQLTeam
Ask SQLTeam Question
0 Posts |
Posted - 2005-02-16 : 08:18:48
|
| Kobus writes "I have a procedure where I import data from a text file. Part of it uses the following lines:Bulk Insert TEMP_InputFrom 'C:\myFolder\myFile.txt' With (FIELDTERMINATOR = '|',ROWTERMINATOR = ';')GOThe above line works fine.What I need is to be able to insert different file names into to the string - replacing the variable @myFileBulk Insert TEMP_InputFrom 'C:\myFolder\'+@myFile+'.txt' With (FIELDTERMINATOR = '|',ROWTERMINATOR = ';')GONothing seems to work after days of many apostrophies...Any suggestions?" |
|
|
jcragle
Starting Member
2 Posts |
Posted - 2005-02-18 : 10:49:43
|
| Declare @SQL varchar(4000)set @SQL = 'Bulk Insert TEMP_Input From C:\myFolder\'+@myFile+'.txtWith (FIELDTERMINATOR = ''|'',ROWTERMINATOR = '';'')'exec (@SQL) |
 |
|
|
|
|
|