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.

 All Forums
 SQL Server 2000 Forums
 Import/Export (DTS) and Replication (2000)
 bulk insert

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2003-12-31 : 08:17:24
erkan writes "declare @var char(29)
declare @var1 char(10)
select @var1=(select convert(varchar(10),dateadd(dd,-1,getdate()),102) )
select @var = 'c:\inetpub\ftproot\' + @var1
print @var
c:\inetpub\ftproot\2003.12.25 --- this is file name


BULK INSERT minilink.dbo.SDH_Perf FROM @var

when I enter this command I could not manage to load the file to table. error message is Incorrect syntax near '@var'.

How can I do it.

Thanks"

nr
SQLTeam MVY

12543 Posts

Posted - 2003-12-31 : 16:08:23
select @var = 'BULK INSERT minilink.dbo.SDH_Perf FROM ''' + @var + ''''

exec (@var)

have a look at
http://www.nigelrivett.net/ImportTextFiles.html

==========================================
Cursors are useful if you don't know sql.
DTS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page
   

- Advertisement -