how to insert the values in 5 table at a time Using any
single statement ?
Answers were Sorted based on User's Feedback
Answer / vishnu
It is not possible to insert multiple rows with a single
insert statement. If you want to insert multiple rows, one
have to write multiple insert statements considering that
you are working SQL server 2005 or it's below version.
But SQL Server 2008 allows to insert multiple rows with a
single insert statement.
As for example,
In sql server 2005, if we need to insert multiple row, we
used to do something like this.
CREATE TABLE [State] (
[StateID] int,
[StateName] VARCHAR(20)
)
GO
INSERT INTO State
VALUES (1, 'Gujarat')
INSERT INTO State
VALUES (2, 'Dehli')
INSERT INTO State
VALUES (3, 'Bihar')
But with SQL Server 2008 we can combine all the three insert
statement in single insert statement. See below:
CREATE TABLE [State] (
[StateID] int,
[StateName] VARCHAR(20)
)
GO
INSERT INTO State
VALUES (1, 'Gujarat'),
(2, 'Dehli'),
(3, 'Bihar')
Hope this helps...
| Is This Answer Correct ? | 17 Yes | 1 No |
Answer / sitakanta rath
Sql Server does not support this. In sql server 2000 n 2005
we cant insert values in multiple tables at a single time.
| Is This Answer Correct ? | 13 Yes | 1 No |
Answer / gvg
By Usngle statementing procedure we have to insert in a si
| Is This Answer Correct ? | 14 Yes | 3 No |
Answer / pradeep kumar
INSERT INTO MyTable (FirstCol, SecondCol)
SELECT 'First' ,1
UNION ALL
SELECT 'Second' ,2
UNION ALL
SELECT 'Third' ,3
UNION ALL
SELECT 'Fourth' ,4
UNION ALL
SELECT 'Fifth' ,5
| Is This Answer Correct ? | 7 Yes | 2 No |
What is scrollable cursor?
What is collation sensitivity? Explain different types.
What is xdr?
How to get the count of distinct records. Please give me the query?
How to rebuild all indexes on a single table?
Explain transaction server explicit transaction?
what are the steps you will take, if you are tasked with securing an sql server? : Sql server database administration
What meant by Performance Tuning,how can we do the performance tuning on stored procedures and tell some steps to do the performance tuning
How is sql server used?
How can you know if the row fetched from cursor is still valid in underlying table?
difference between select column name from table name where serviceid=2; and select max(column name) from table name where serviceid=2; IN ORACLE
What is index, cluster index and nonclustered index?
Oracle (3259)
SQL Server (4518)
MS Access (429)
MySQL (1402)
Postgre (483)
Sybase (267)
DB Architecture (141)
DB Administration (291)
DB Development (113)
SQL PLSQL (3330)
MongoDB (502)
IBM Informix (50)
Neo4j (82)
InfluxDB (0)
Apache CouchDB (44)
Firebird (5)
Database Management (1411)
Databases AllOther (288)