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
 General SQL Server Forums
 Database Design and Application Architecture
 read data from text file and insert to sql table

Author  Topic 

mohinsoft
Starting Member

7 Posts

Posted - 2008-03-28 : 12:10:07
hi my friends
i want read data from text file,and write to my table in sql,
please help me

M.O.H.I.N

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2008-03-28 : 12:31:55
You can use bcp, bulk insert, or DTS/SSIS.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/
Go to Top of Page

mohinsoft
Starting Member

7 Posts

Posted - 2008-03-28 : 12:43:57
thans my friend but i want write code to T-sql
what is source code?
i use code :

insert into mytableinsql
select * from OPENROWSET
('Microsoft.Jet.OLEDB.4.0',
'Excel 8.0;Database=C:\myfile.xls;',
'SELECT * FROM [mysheet$]')

for excel to sql
bud i dont know for text file
please help me....
thanks

M.O.H.I.N
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2008-03-28 : 15:20:24
BULK INSERT is a T-SQL command.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/
Go to Top of Page

mohinsoft
Starting Member

7 Posts

Posted - 2008-03-30 : 12:10:38
thanks my dear friend
can you help me more?
or put sample code?

Tnx 4 u




M.O.H.I.N
Go to Top of Page

sodeep
Master Smack Fu Yak Hacker

7174 Posts

Posted - 2008-03-30 : 12:22:10
You can do with Import/Export wizard. How big is the data?
Go to Top of Page

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2008-03-30 : 13:09:43
the BOL = books online = sql server help has example on the use of bulk insert.

also google has tons of examples.

_______________________________________________
Causing trouble since 1980
blog: http://weblogs.sqlteam.com/mladenp
SSMS Add-in that does a few things: www.ssmstoolspack.com
Go to Top of Page
   

- Advertisement -