var sidebar_align = 'right';
var content_container_margin = parseInt('290px');
var sidebar_width = parseInt('270px');
Unanswered: multiple records
I am new at sql programming and I need all the help i can possibly get..Im using SQL Server 2000 and I have been given an assignment which follows:
- i have to add 100 new records at once to an existing table.
I have to do it through SQL Server only( query analizer,i suppose) and I am not allowed to use any other languages to achieve this. Now, my question is how can i do it through sql only? What is the code i have to write to make this thing work? I simply dont know where and how to start...
thanx in advance and sorry for my bad english
look up INSERT as Transact-SQL reference in BOL (Books Online, press SHIFT-F1 in the analyser).
Thanx, Ive already done that, but i didnt find it very useful in this case..
In which form do you have the data? In a flat file (pure text) or do you have to type it in?
I have to type the data in.
In this case, I see two possibilites
1. Write an SQL-Statement like:
INSERT INTO table_1 VALUES (Value1, Value2, ValueN)
2. Use SQL Server Enterprise Manager. Open the table and type the data in. (right mouse click on table_1 and select "Open Table > Return All Rows").
OK, that would be a solution for inserting one record, right?Now , how do i insert 100 records at once?Cause thats the core of my problem..and its really driving me crazy!
Why does the teacher want you to insert 100 rows at once? Is there some point they are trying to make?
This can be done using just MS-SQL (using a union), but it is very poor design.
When you go for way 1 you have to create an INSERT-statement for every record you want to insert.
Thanx everyone on your replies!
yeah, or create a temporary table inwhich you do the 100 inserts one by one and then do one insert selecting all the records from the temp. table into the final destination table