how to insert the values in 5 table at a time Using any
single statement ?
Answer Posted / 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 |
Post New Answer View All Answers
Is natural join and equi join same?
what number files will a information contain in SQL Server? How many forms of information files exist in SQL Server? How many of those files can exist for a single database?
What are four major operators that can be used to combine conditions on a where clause?
How to create a simple stored procedure in ms sql server?
Can I use sql azure as a backup with log shipping or database mirroring?
List the different types of collation sensitivities in sql server?
What is the difference between sql server 2000 object owner and sql server 2005 schema? : sql server database administration
How do I find my localdb version?
Write a SQL queries on Self Join and Inner Join.
What is the minimum and maximum number of partitions required for a measure group? : sql server analysis services, ssas
How do I install only the client tools of sql server 2000?
What are views used for?
How to write a query with a full outer join in ms sql server?
When would you use a before or after trigger?
What is the difference between left and right outer join?