|
|
|||||||||
|
|||||||||
|
|||||||||
| |
||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Script to insert 1000 rows in a database table
Please guide me as to how to write a script to insert 1000
rows in a table automatically for SQL Server. the table has structure like Table1(id int,name varchar, date datetime,currency money) Thanx in advance. |
|
#2
|
|||
|
|||
|
You need an INSERT INTO statement, although I think you can only do one row at a time.
e.g. INSERT INTO Table1 (id int,name varchar, date datetime,currency money) VALUES (1,'Bloggs','16/07/2004','£100.52') If you have the data in a CSV file, you could import it into your database as a different table (Table2), then try an insert select statement INSERT INTO Table1 (id,name,date,currency) SELECT id, name, date, currency FROM Table2 |
|
#3
|
|||
|
|||
|
Insertion at one time
One row at a time is an easy task.
What i wanted to do was insert multiple rows at the same time and autogenerate the values. I have succeeded in doing just that. Thanks Anyway (P.S. I will post the code as soon as i am completely done with it for the benifit of others refering this post) |
|
#4
|
||||
|
||||
|
Look into MS SQL's BCP (Bulk Copy Program) or DTS (Data Transformation Service).
|
![]() |
| Viewing: ASP Free Forums > Database > Microsoft SQL Server > Script to insert 1000 rows in a database table |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|