Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 INSERT STATMENT

Author  Topic 

sadbjp
INNER JOIN

41 Posts

Posted - 2007-05-01 : 18:24:00
Hi All,

I have a table "Person" that has two columns "FirstName" and "LastName".
How can I insert multiple rows into this table using the INSERT stsmt.
I want to use just one insert statement.

Thanks in advance,
Vishal S

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2007-05-01 : 18:26:09
[code]
insert into Person (FirstName, LastName)
select 'a', 'b' inner join
select 'c', 'd'
[/code]


KH

Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2007-05-01 : 18:27:08
INSERT Person (FirstName, LastName)
SELECT FirstName, LastName
FROM Table2


Peter Larsson
Helsingborg, Sweden
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2007-05-02 : 01:51:19
quote:
Originally posted by khtan

insert into Person (FirstName, LastName)
select 'a', 'b' inner join
select 'c', 'd'

Tired?
I think INNER JOIN should be an UNION ALL, right?


Peter Larsson
Helsingborg, Sweden
Go to Top of Page

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2007-05-02 : 02:56:16
quote:
Originally posted by Peso

quote:
Originally posted by khtan

insert into Person (FirstName, LastName)
select 'a', 'b' inner join
select 'c', 'd'

Tired?
I think INNER JOIN should be an UNION ALL, right?


Peter Larsson
Helsingborg, Sweden



You are right . Yeah tired. Not enough sleep last night.


KH

Go to Top of Page
   

- Advertisement -