how to insert the values in 5 table at a time Using any
single statement ?

Answers were Sorted based on User's Feedback



how to insert the values in 5 table at a time Using any single statement ? ..

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

how to insert the values in 5 table at a time Using any single statement ? ..

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

how to insert the values in 5 table at a time Using any single statement ? ..

Answer / gvg

By Usngle statementing procedure we have to insert in a si

Is This Answer Correct ?    14 Yes 3 No

how to insert the values in 5 table at a time Using any single statement ? ..

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

how to insert the values in 5 table at a time Using any single statement ? ..

Answer / bintesh

use of the tigger

Is This Answer Correct ?    3 Yes 2 No

how to insert the values in 5 table at a time Using any single statement ? ..

Answer / d

d

Is This Answer Correct ?    0 Yes 7 No

Post New Answer

More SQL Server Interview Questions

Explain error handling in ssis?

0 Answers  


How many nested transaction can possible in sql server?

3 Answers   Bank Of America,


What are commonly used mssql functions in php?

0 Answers  


What is a join and their types?

2 Answers   Challenger Financial,


How to write query to Delete the records in child table and corresponding records in parent table

11 Answers   Semantic Space,






Consider the table T1 it consits A,2,3,4 consider another table t2 it contain 1,2a,3a,4a now i need o get the upadted answer

3 Answers  


Explain having clause?

0 Answers  


HOW TO FIND THE EMPLOYEE DETAILS WHO ARE GETTING SAME SALARY IN EMP TABLE

18 Answers   Infosys, TCS,


What is index fragmentation in ms sql server?

0 Answers  


Do you know how to store and query spatial data?

0 Answers  


Can we create clustered index on composite key?

0 Answers  


Define the term DML, DDL and DTL?

1 Answers  


Categories