all groups > sql server programming > february 2004 >
You're in the

sql server programming

group:

need ideas on importing delimited text files



need ideas on importing delimited text files TJS
2/5/2004 10:35:32 PM
sql server programming: I need to import delimited text files:
-webhost locked out bulk insert
-building insert queries takes too much cpu
-admin privileges not available

what else is an option??

Re: need ideas on importing delimited text files TJS
2/5/2004 11:14:07 PM
the webhost does not allow DTS packages on their server either


[quoted text, click to view]

Re: need ideas on importing delimited text files TJS
2/6/2004 12:32:57 AM
this is on a webhost I can't run exe files



"Tibor Karaszi" <tibor_please.no.email_karaszi@hotmail.nomail.com> wrote in
message news:OPHsfTI7DHA.1816@TK2MSFTNGP12.phx.gbl...
[quoted text, click to view]

Re: need ideas on importing delimited text files TJS
2/6/2004 1:16:10 AM
with this sp I get an error message about setting ANSI nulls and warnings.

How do I enable these options??
also , does using sp_addlinkedserver require admin privileges ??

========================================
CREATE PROCEDURE NCL_Import_ODBC AS

EXEC sp_addlinkedserver _private, 'Jet 4.0',
'Microsoft.Jet.OLEDB.4.0', 'C:\_private', NULL, 'Text'

select * from _private...table1#txt

GO
=======================================

[quoted text, click to view]

Re: need ideas on importing delimited text files Steve Kass
2/6/2004 3:30:44 AM
OpenRowSet? You can do this kind of thing:

select * from OpenRowset('Microsoft.Jet.OLEDB.4.0',
'Text;Database=C:\datadirectory\;HDR=NO','SELECT * FROM myTextFile#txt')

The way it imports is dependent on some registry settings, and there's
some more information here:
groups.google.com/groups?q=C183FB8D-7346-4ABF-9BC8-F3BABCFB46CA

and in this article, which uses a linked server, but should still be
relevant:
"Using the Microsoft Jet ODBC driver for text files" at
http://users.drew.edu/skass/sql/ <TextDriver.htm>

SK


[quoted text, click to view]
Re: need ideas on importing delimited text files Tibor Karaszi
2/6/2004 8:42:54 AM
You can use "BCP" through DMO. Check out the BulkCopy object, for instance. Or use the regular
BCP.EXE...

--
Tibor Karaszi, SQL Server MVP
Archive at: http://groups.google.com/groups?oi=djq&as_ugroup=microsoft.public.sqlserver


[quoted text, click to view]

Re: need ideas on importing delimited text files TJS
2/6/2004 10:00:53 AM
I continue to get error mesage about ansi nulls and warnings.

This is on a webhost so settings can't be changed


[quoted text, click to view]

Re: need ideas on importing delimited text files Tibor Karaszi
2/6/2004 11:03:16 AM
The idea is that you'd run the file locally, which connects to the SQL Server over the net. But if
it is a web host, they might not allow direct-access to the SQL Server.

Where does the text file reside? Locally or on the web-host machine?
--
Tibor Karaszi, SQL Server MVP
Archive at: http://groups.google.com/groups?oi=djq&as_ugroup=microsoft.public.sqlserver


[quoted text, click to view]

Re: need ideas on importing delimited text files Steve Kass
2/6/2004 12:37:25 PM
sp_addlinkedserver permission is for sysadmin and setupadmin roles, by
default. That and the SET options requirements are described in Books
Online under sp_addlinkedserver.

You should try OpenRowSet:

select * from OpenRowSet('Microsoft.Jet.OLEDB.4.0',
'Text;Database=C:\_private;HDR=NO','SELECT * FROM table1#txt')

To get it to work, you may also need to change registry settings to
import TABdelimited or change NO to YES. See the links I pointed you to.

SK

[quoted text, click to view]
Re: need ideas on importing delimited text files Mary Bray
2/6/2004 6:05:11 PM
DTS?

[quoted text, click to view]

Re: need ideas on importing delimited text files Tibor Karaszi
2/6/2004 7:37:50 PM
Check out following commands in Books Online:

SET ANSI_WARNING
SET ANSI_NULLS

--
Tibor Karaszi, SQL Server MVP
Archive at:
http://groups.google.com/groups?oi=djq&as_ugroup=microsoft.public.sqlserver


[quoted text, click to view]

Re: need ideas on importing delimited text files TJS
2/7/2004 12:35:34 AM
Where is books online



"Tibor Karaszi" <tibor_please.no.email_karaszi@hotmail.nomail.com> wrote in
message news:eAghPBO7DHA.2404@TK2MSFTNGP11.phx.gbl...
[quoted text, click to view]

Re: need ideas on importing delimited text files TJS
2/7/2004 12:37:36 AM
everything is on the web host and most isp's like mine don't allow remote
connections to sql server because it is claimed to be a yet another security
risk.


"Tibor Karaszi" <tibor_please.no.email_karaszi@hotmail.nomail.com> wrote in
message news:%23%23927hJ7DHA.4060@tk2msftngp13.phx.gbl...
[quoted text, click to view]

Re: need ideas on importing delimited text files Tibor Karaszi
2/7/2004 10:03:59 AM
In the SQL Server program group.

--
Tibor Karaszi, SQL Server MVP
Archive at:
http://groups.google.com/groups?oi=djq&as_ugroup=microsoft.public.sqlserver


[quoted text, click to view]

Re: need ideas on importing delimited text files Tibor Karaszi
2/7/2004 10:05:18 AM
OK, so if the text file resides on the server side, I suggest you look into
OPENROWSET, as suggested by Steve.

--
Tibor Karaszi, SQL Server MVP
Archive at:
http://groups.google.com/groups?oi=djq&as_ugroup=microsoft.public.sqlserver


[quoted text, click to view]

Re: need ideas on importing delimited text files TJS
2/7/2004 11:30:31 AM
I'm using msde - I have no books online


"Tibor Karaszi" <tibor_please.no.email_karaszi@hotmail.nomail.com> wrote in
message news:uh6XPlV7DHA.2480@TK2MSFTNGP12.phx.gbl...
[quoted text, click to view]

Re: need ideas on importing delimited text files Steve Kass
2/7/2004 4:00:48 PM
Books Online is a free download:

http://www.microsoft.com/sql/techinfo/productdoc/2000/books.asp

SK

[quoted text, click to view]
Re: need ideas on importing delimited text files Steve Kass
2/7/2004 4:01:27 PM
This is another helpful link:
http://www.microsoft.com/sql/msde/techinfo/default.asp

SK

[quoted text, click to view]
Re: need ideas on importing delimited text files TJS
2/7/2004 7:53:33 PM
thank you !


[quoted text, click to view]

AddThis Social Bookmark Button