| Author |
Topic |
|
Moozzie
Starting Member
17 Posts |
Posted - 2007-12-14 : 06:53:55
|
| Hi foks!In MYSQL I can insert a whole text/excel/csv file with the Load Data command. Can I do such a thing for MSSQL?Thank you! |
|
|
harsh_athalye
Master Smack Fu Yak Hacker
5581 Posts |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2007-12-14 : 07:21:03
|
quote: Originally posted by Moozzie Hi foks!In MYSQL I can insert a whole text/excel/csv file with the Load Data command. Can I do such a thing for MSSQL?Thank you!
Read about bcp or openrowset in sql server help fileMadhivananFailing to plan is Planning to fail |
 |
|
|
Moozzie
Starting Member
17 Posts |
Posted - 2007-12-14 : 07:23:58
|
| I think we have a misunderstanding hereThe is the first 3 rows of the text file1,9864327,email@email.com2,2386647,email@email.com3,4789182,email@email.comAnd i want to insert those results in the database. But i don't want to do this:INSERT INTO [table] SET (field,field,field) VALUES (value,value,value)For each record.In mYsql I can insert the data of the csv file and then he will insert all records/rows to the databaseCan mSsql do that ?? |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2007-12-14 : 07:25:19
|
quote: Originally posted by Moozzie I think we have a misunderstanding hereThe is the first 3 rows of the text file1,9864327,email@email.com2,2386647,email@email.com3,4789182,email@email.comAnd i want to insert those results in the database. But i don't want to do this:INSERT INTO [table] SET (field,field,field) VALUES (value,value,value)For each record.In mYsql I can insert the data of the csv file and then he will insert all records/rows to the databaseCan mSsql do that ??
You need to read my previous replyMadhivananFailing to plan is Planning to fail |
 |
|
|
Moozzie
Starting Member
17 Posts |
Posted - 2007-12-14 : 07:30:03
|
| @madhivananI did not see yours before i post a reply ;-)I will read about bcp and openrowset |
 |
|
|
Moozzie
Starting Member
17 Posts |
Posted - 2007-12-14 : 07:42:07
|
| Oke i see that my aplication (Aqua Data Studio) can import these csv files and i'm happy with that. But it must also be done by Batch, so is there a SQL command for wich can handle the import himself? |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2007-12-14 : 08:06:37
|
Example from sql server help fileBULK INSERT Northwind.dbo.[Order Details] FROM 'f:\orders\lineitem.tbl' WITH ( FIELDTERMINATOR = '|', ROWTERMINATOR = '|\n' ) MadhivananFailing to plan is Planning to fail |
 |
|
|
Moozzie
Starting Member
17 Posts |
Posted - 2007-12-14 : 11:49:51
|
| You dont know how much you helped me with this :DThanks ! |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2007-12-15 : 01:18:31
|
quote: Originally posted by Moozzie You dont know how much you helped me with this :DThanks !
In fact, I know MadhivananFailing to plan is Planning to fail |
 |
|
|
|