471,599 Members | 1,582 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,599 software developers and data experts.

Flat file source import to SQL databse

I need help on how to import a Flat file source into SQL database, but the name of the file (part of the name) changes everyday. How can I create a method to import the file everyday into a new table without automatically ?
Mar 28 '07 #1
1 1544
iburyak
1,017 Expert 512MB
Try this:


[PHP]DECLARE @FilePath varchar(50), @SQL varchar(8000)

select @FilePath = '\\servernamehere\ftproot$\TEST'

SELECT @SQL = 'SELECT *
FROM OpenDataSource( ''Microsoft.Jet.OLEDB.4.0'',
''Data Source="' + @FilePath + '";Extended properties=Text'')...TEST#txt'

execute(@SQL)[/PHP]

It works on one of my servers and not on another.
TEST#txt is file name. You can change it.
Mar 28 '07 #2

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

13 posts views Thread by raykyoto | last post: by
1 post views Thread by ED | last post: by
1 post views Thread by ROS38 | last post: by
3 posts views Thread by =?Utf-8?B?YzY3NjIyOA==?= | last post: by
reply views Thread by Anwar ali | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.