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
What is cursor in ms sql server?
How do I schedule a sql server profiler trace?
How to rename an existing column with the "sp_rename" stored procedure in ms sql server?
What programming language would you use to create embedded functions in ssrs?
Where are sql server usernames and passwords stored in the sql server?
Do you know sql server 2008 introduces automatic auditing?
What happens if we shrink log file in sql server?
What is difference between clustered and non clustered index?
What triggers long term care?
Explain forward - only cursors?
Can you force a query to use a specific index?
What is public role in sql server?
What is meant by Active-Passive and Active-Active clustering setup?
Can you name a few encryption mechanisms in sql server?
What is a database in ms sql server?