PDA

View Full Version : import from file


carlosvs
04-05-02, 07:27
Hello every body.
I' m a guy from spain and this is my first message, and like you are going to check my english is not very good.
I have a problem with T-Sql in the SQL server 7.
I have to import data from files several times a day.
i'm trying to use de Bulk Insert command but i have problems with the variable witch contain the name of file:

set @file = 'c:\pruebas\lw' + char(@last + 1) + '.dat'
Bulk insert tbl_Latewar from @file with ( fieldterminator = ' ' , firstrow = 1 , lastrow = 1 )

it gives me a 170 error.
if you know another command to do this, please tell me.

if would help me i'll be very gratefully.
Thanks in advance.

rnealejr
04-25-02, 17:54
That error means there is a syntax probem.

Have you tried the same command but with the file name inserted instead of a variable ?