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
Can binary strings be used in arithmetical operations?
What is the maximum size of sql server database?
What is change tracking in sql server?
Explain in brief about Microsoft SQL server?
Where to find ntwdblib.dll version 2000.80.194.0?
Why you need indexing? Where that is stored and what you mean by schema object? For what purpose we are using view?
What is the data type of time?
How do you clear a log file?
What is the default server name for sql server?
What is the sql server 2000 version number?
What are cursors stored procedures and triggers?
What do you do in data exploration
How to check what was the last restore transaction LSN in Log shipping or Mirroring? when we don't have a Monitor or witness server.
do you know how to configure db2 side of the application? : Sql server database administration
What command do we use to rename a database?