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 is Upsetting

Author  Topic 

Xerxes
Aged Yak Warrior

666 Posts

Posted - 2010-08-19 : 13:35:13
Here's my code...I'm trying to pull in a text file that is pipe-delimited (pipe=HEX '7C').

DROP TABLE Tickets_INPUTFILE
SELECT * INTO Tickets_INPUTFILE
FROM OPENROWSET('Microsoft.Jet.OLEDB.4.0','Text;Database=D:\Source','SELECT * FROM TIX_LW.txt')
GO


But I'm not getting my data split up (by the pipes) into appropriate columns. What am I missing here?


Semper fi,
XERXES, USMC(Ret.)
------------------------------------------------------
The Marine Corps taught me everything but SQL & VB obviously!

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2010-08-19 : 13:53:37
use a format file and specify file delimiter as pipe

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

Xerxes
Aged Yak Warrior

666 Posts

Posted - 2010-08-19 : 14:11:44
But I want to create the table on the fly, not based on a pre-established table.

Semper fi,
XERXES, USMC(Ret.)
------------------------------------------------------
The Marine Corps taught me everything but SQL & VB obviously!
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2010-08-19 : 14:13:58
does that mean table structure keeps on changing?

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

Xerxes
Aged Yak Warrior

666 Posts

Posted - 2010-08-19 : 14:43:43
It might.

Semper fi,
XERXES, USMC(Ret.)
------------------------------------------------------
The Marine Corps taught me everything but SQL & VB obviously!
Go to Top of Page

yosiasz
Master Smack Fu Yak Hacker

1635 Posts

Posted - 2010-08-19 : 15:31:57
is it possible for you to post sample txt file?

If you don't have the passion to help people, you have no passion
Go to Top of Page
   

- Advertisement -