473,394 Members | 1,759 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 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 1599
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

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

Similar topics

1
by: Larry Rekow | last post by:
I have a report that's created each day as a flat textfile. Because I came from the Access world, I created a macro that imports it with a schema that gives meaningful names to the various...
3
by: Yellowbird | last post by:
I have an HTML form with a pre-built table containing "standard" column headings (for example, First Name, Last Name, SSN, Hours, etc.). I want a user to be able to enter values into the form and...
13
by: raykyoto | last post by:
Hi all, I'm sure this is a popular question that comes up every few months here. Indeed, I've looked at some of the past postings, but I would like to ask things differently. Basically, I'm...
1
by: ED | last post by:
Can anyone give me a solution to loading a flat file with an extension of .txt into an access table automatically, aka user clicks a command button. Thanks
1
by: ROS38 | last post by:
I have an access 97 (I know, it's old, they won't let me upgrade, don't ask) databse that many of the people in my company use pretty constantly. Using it with access produces no errors ever....
4
by: Podi | last post by:
Hi, I am trying to copy all files under a directory tree to a single directory (in Windows). I can well write the script myself, but was wonder if anyone has done it so I won't be reinventing...
3
by: blackd77 | last post by:
What I would LIKE to do is noted in the subject line. What I'm finding is that "edit SQL" appears to only be an option if I am creating a table. If I select "append to" the option to edit SQL...
1
by: Liz2 | last post by:
I am trying to read a flat file as the source file with space as the delimiter. I am using the "SQL Import and Export Wizard", and under the "demilited", there is the following options: {CR} {LF}...
3
by: =?Utf-8?B?YzY3NjIyOA==?= | last post by:
Hi all, I have a question for you. I have a .csv file which has many lines of data. Each line has many data fields which are delimited by ",". Now I need to extract part of data from this...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.