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
 SQL Server Development (2000)
 Text File drop into a table

Author  Topic 

edb2003
Yak Posting Veteran

66 Posts

Posted - 2003-09-25 : 17:57:11
Hi Everyone,
I am beginning to enjoy this stuff.

Got my stored procedures and schedules in tact to take information from a table (Container) in SQL to apend to other tables in SQL (table2, table3, table4).

Everyday, I will get a text file full of data. How can I automate the process from the text file to dump all of its content into the table (Container) into SQL.

I thank everyone at SQL Team for this.
hppy Dy.
Edb

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2003-09-25 : 17:58:44
You could use bcp or DTS to do this. What format is the text file in?

Tara
Go to Top of Page

edb2003
Yak Posting Veteran

66 Posts

Posted - 2003-09-25 : 18:06:51
Thanks Tara,
It is using fixed width txt file. Data was pulled from a proprietary mantus program.

Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2003-09-25 : 18:12:34
If the file name does not change, then bcp will be the fastest.

bcp is an executable that can be from a command window. It can also be run in Query Analyzer using xp_cmdshell.

Here is an example of bcp at a command window:

bcp DBName.dbo.ObjectName in E:\Data\Somefile.txt -Sserver1 -T -c -r\r\n

Just run bcp /? at a cmd window to see what options are available. Books Online has more details.

Tara
Go to Top of Page

edb2003
Yak Posting Veteran

66 Posts

Posted - 2003-09-25 : 18:38:28
Excellent input Tara ... Thx for your generous help :)

edb
Go to Top of Page

X002548
Not Just a Number

15586 Posts

Posted - 2003-09-26 : 09:48:56
Didn't we do this already?

Cut and paste the code I gave you in to a stored procedure...

Then use Enterprise Manager, go to the Managers folder, the SQL Server Agent, abd create a new job that will execute the stored procedure..It can be schedule any way you want it...

It's like dejavu all over again...

http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=29387



Brett

8-)

SELECT @@POST FROM Brain ORDER BY NewId()

That's correct! It's an AlphaNumeric!
Go to Top of Page
   

- Advertisement -