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
 SQL Server 2000 Forums
 SQL Server Development (2000)
 How to Insert 1 ROW several Times changing only ke

Author  Topic 

CLages
Posting Yak Master

116 Posts

Posted - 2004-04-20 : 07:51:42
hi.
How to Insert one ROW several Times changing only part of the key

I have a Table named EMPRESA(in English Company) and Other Named PLANO (in English Account)

Table Empresa

Codigo(key) Nome
01 ACME
02 Lages Company
03 Sql Company


O would like to Insert 123456 (conta) for all EMPRESA I found in Table EMPRESA

in this case would be:


(key) (key)
Empresa Conta Valor
01 123456 0
02 123456 0
03 123456 0


how can i do this?

I think i should do a loop for by EMPRESA
and for each EMPRESA, i Insert PLANO.

i am not sure

tks

Carlos Lages

AndrewMurphy
Master Smack Fu Yak Hacker

2916 Posts

Posted - 2004-04-20 : 07:55:27
insert into plano
select a.codigo, 123456, 0 from empresa a
Go to Top of Page
   

- Advertisement -