Monday, March 26, 2012

import from file

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.That error means there is a syntax probem.

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

No comments:

Post a Comment