I have been trying to import a notepad txt file into my SQL server. I go through the routine of importing it, either through table or DTS and it just hangs up, nothing happens. Do I need to parse the text file first? If I need to parse it, how do I do that? Does anyone have any idea on why it won't import? Thanks for helping.
Importing a notepad txt file into SQL 2000 Server
Collapse
X
-
Originally posted by iburyakToday is the same question from all people.
Unfortunately I have the same answer. You can load data into a temp table with all character columns first and do parsing on database side while inserting data into a production table.Comment
-
You can use following ways to insert data into a table from a text file:
1.
[PHP]CREATE TABLE SomeTable (Results varchar(4000) null)
go
INSERT INTO SomeTable(Resul ts)
exec ('master..xp_cm dshell ''type d:\yourfile.txt ''')[/PHP]
2.
[PHP]CREATE TABLE SomeTable (Results varchar(4000) null)
go
BULK INSERT YourDatabase.db o.[SomeTable]
FROM 'd:\yourfile.tx t' [/PHP]
3.
[PHP]CREATE TABLE SomeTable (Results varchar(4000) null)
go
Insert into YourDatabase.db o.[SomeTable]
SELECT *
FROM OpenDataSource( 'Microsoft.Jet. OLEDB.4.0',
'Data Source="d:\your file.txt";Exten ded properties=Text ')[/PHP]Comment
-
Originally posted by iburyakYou can use following ways to insert data into a table from a text file:
1.
[PHP]CREATE TABLE SomeTable (Results varchar(4000) null)
go
INSERT INTO SomeTable(Resul ts)
exec ('master..xp_cm dshell ''type d:\yourfile.txt ''')[/PHP]
2.
[PHP]CREATE TABLE SomeTable (Results varchar(4000) null)
go
BULK INSERT YourDatabase.db o.[SomeTable]
FROM 'd:\yourfile.tx t' [/PHP]
3.
[PHP]CREATE TABLE SomeTable (Results varchar(4000) null)
go
Insert into YourDatabase.db o.[SomeTable]
SELECT *
FROM OpenDataSource( 'Microsoft.Jet. OLEDB.4.0',
'Data Source="d:\your file.txt";Exten ded properties=Text ')[/PHP]
respected sir.
i am also working on the same issue . i have a connection with sql server 2000 via odbc and i have got query results from sql server 2000 in php web page.
would u please tell me that what is proper method of writing these commands in php.
i write them as it as get nothing then i write with echo method and i get these lines at output as it is.
kindly tell me how it would be beneficial.
a bundle of thanks in advance
regards
maanijanjuaComment
Comment