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 2005 Forums
 Transact-SQL (2005)
 OPENROWSET Format File dynamic

Author  Topic 

yosiasz
Master Smack Fu Yak Hacker

1635 Posts

Posted - 2008-05-22 : 12:34:12
Hi,

Can someone please point me as to where I can find info for the following. I have seen this somewhere but I am unable to find it.

I am trying to do
INSERT INTO Table
SELECT ...
FROM OPENROWSET(BULK '\\sharedDrive\DataFile.txt',
FORMATFILE = '\\sharedDrive\FormatFile.txt',
FIRSTROW = 2)
AS Q

How can I make that shared drive dynamic? as such..hoping not to use dynaic SQL
INSERT INTO Table
SELECT ...
FROM OPENROWSET(BULK @SharedDrive DataFile.txt',
FORMATFILE = @SharedDrive FormatFile.txt',
FIRSTROW = 2)
AS Q

yosiasz
Master Smack Fu Yak Hacker

1635 Posts

Posted - 2008-05-22 : 14:42:45
ok i got the answer for this. this would have been overkill just used
BULK INSERT instead.
Go to Top of Page
   

- Advertisement -