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)
 Insert into a Temp table from a text file

Author  Topic 

Jim Beam
Posting Yak Master

137 Posts

Posted - 2010-09-24 : 11:20:16
Hi all,

I need to Insert into a temp table called #InsertQueues all the contents of an text file, about 2 columns.

The .txt columns don't have names, but contain phone numbers and a text column.

Cheers,

Jim.

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2010-09-24 : 13:41:02
About 2 columns? Or 2 columns exactly?

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page

Jim Beam
Posting Yak Master

137 Posts

Posted - 2010-09-24 : 13:42:41
2 columns exactly!!
Go to Top of Page

X002548
Not Just a Number

15586 Posts

Posted - 2010-09-24 : 13:47:45
Why does it have to be a temp table

Can't you just make a permanent staging table?

What format is the data in? Comma delimited? Tab delimited? Pipe delimited? Fixed width?

In any case, I would use bcp

Or, you can go talk to Lampy



Brett

8-)

Hint: Want your questions answered fast? Follow the direction in this link
http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx


Want to help yourself?

http://msdn.microsoft.com/en-us/library/ms130214.aspx





Go to Top of Page

Jim Beam
Posting Yak Master

137 Posts

Posted - 2010-09-25 : 05:29:20
quote:
Originally posted by X002548

Why does it have to be a temp table

Can't you just make a permanent staging table?

What format is the data in? Comma delimited? Tab delimited? Pipe delimited? Fixed width?

In any case, I would use bcp

Or, you can go talk to Lampy
Brett

8-)

Hint: Want your questions answered fast? Follow the direction in this link
http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx


Want to help yourself?

http://msdn.microsoft.com/en-us/library/ms130214.aspx



The 2 Excel columns will be pasted straight into the .txt file. It would be easier to create a temp table instead of worrying about columnames for a fixed staging table.
Go to Top of Page

Jim Beam
Posting Yak Master

137 Posts

Posted - 2010-09-27 : 06:19:27
See new thread on Bulk Insert, please.
Go to Top of Page
   

- Advertisement -