Insert Que Nem Select Com Duas Tabelas.
Started By Édipo Costa Rebouças, 03/11/2008, 09:27
12 replies to this topic
#1
Posted 03/11/2008, 09:27
galera, sou muito noob em sql, e preciso fazer inserir uma tupla numa tabela um e adicionar N tuplas numa tabela2 com uma chave um campo como o mesmo id da tabela um.
Tipo algo assim.
Insert into tabelaA a, tabelaB b where b.campo = a.(campo com auto-incremente)
vlw
Tipo algo assim.
Insert into tabelaA a, tabelaB b where b.campo = a.(campo com auto-incremente)
vlw
#2
Posted 03/11/2008, 09:51
INSERT é uma tabela por vez!
Se você quer fazer tudo de uma vez utilize uma stored procedure ou uma trigger, se for uma regra geral.
Se você quer fazer tudo de uma vez utilize uma stored procedure ou uma trigger, se for uma regra geral.
#3
Posted 04/03/2009, 09:40
Vc pode fazer da seguinte forma:
Um exemplo rápido:
/* Inserção de dados na tabela 1*/ select @@identity -- seleciona a pk criada pelo insert acima /* Inserção de dados na tabela 2 utilizando o @@identity como parâmetro na inserção */
Um exemplo rápido:
create table tabela1(cod int identity, descricao char(10)) create table tabela2(cod int identity, descricao char(10), cod1 int) insert into tabela1 values('Tbl1') insert into tabela2 values('DadosTbl2', @@identity) select * from tabela1 select * from tabela2
Edição feita por: Renan L. Queiroz, 04/03/2009, 09:54.
Especialidade: Desenvolvimento e Banco de Dados.
Este post lhe ajudou? Agradeça:
#4
Posted 21/09/2017, 08:02
Can I Purchase Acticin Scabisan cialis Canadian Pharmacy Nizagara
Cialis Canandien Zithromax Sore Tongue Dilantin
Genraic Viagra For Men <a href=http://cialtobuy.com>cheap cialis</a> Kamagra Oral Gel
Cialis 20 Mg Compra cheap cialis Levitra Pills Online
Viagra Generico Bilbao accutane online india
Lily Icos Cialis <a href=http://cialtobuy.com>cialis online</a> Cephalexin Online Pharmacy
Farmacia Canadiense Viagra generic cialis Cafergot Available In Canada
Priligy Precio En Peru
Kamagra Uk Viagra <a href=http://cialtobuy.com>cheap cialis</a> Levaquin In Australia Shop
Cialis Canandien Zithromax Sore Tongue Dilantin
Genraic Viagra For Men <a href=http://cialtobuy.com>cheap cialis</a> Kamagra Oral Gel
Cialis 20 Mg Compra cheap cialis Levitra Pills Online
Viagra Generico Bilbao accutane online india
Lily Icos Cialis <a href=http://cialtobuy.com>cialis online</a> Cephalexin Online Pharmacy
Farmacia Canadiense Viagra generic cialis Cafergot Available In Canada
Priligy Precio En Peru
Kamagra Uk Viagra <a href=http://cialtobuy.com>cheap cialis</a> Levaquin In Australia Shop
#7
Posted 07/10/2017, 14:40
Progesterone Hormone Replacement Mastercard Accepted Order Amoxil online pharmacy Viagra Generic Cialis Generic Viagra Buy Flagyl Usa
Zithromax Twice A Day acquista vardenafil Finasteride Avis Viagra From India Abbreviation
Zithromax Twice A Day acquista vardenafil Finasteride Avis Viagra From India Abbreviation
#8
Posted 09/10/2017, 11:55
Amoxicillin Injection Manufacturers In Spain viagra Comprare Viagra On Line E Reato Cheap Silagra
Levitra A Vendre Propecia Ivf viagra online prescription Canadian Pharamacy Prix Cialis Vidal Cialis 2.5 Mg Tablet
Levitra Samples Europe Faq Finasteride Propecia Buy Generic Cialis Online Canada online pharmacy 5142.1 Propecia Hort Auf Zu Wirken Viagra In Der Apotheke
Levitra A Vendre Propecia Ivf viagra online prescription Canadian Pharamacy Prix Cialis Vidal Cialis 2.5 Mg Tablet
Levitra Samples Europe Faq Finasteride Propecia Buy Generic Cialis Online Canada online pharmacy 5142.1 Propecia Hort Auf Zu Wirken Viagra In Der Apotheke
#9
Posted 11/10/2017, 22:36
Doxycycline Delivered generic levitra shipped from usa Proventil Hfa 90 Mcg Inhaler By Mail Propecia Venta
#10
Posted 25/10/2017, 16:05
Types Of Propecia Tab Provera Triclofem Amenorrhoea On Sale Website Poole viagra Cialis Oder Levitra
Forum Acheter Viagra Doctissimo Over The Counter Zithromax Viagra Ohne Rezept Serios levitra billig Priligy Tijuana
Viagra Ohne Rezept Niederlande levitra 40 mga for sale mexico beach Prednisone Without A Scrip
Forum Acheter Viagra Doctissimo Over The Counter Zithromax Viagra Ohne Rezept Serios levitra billig Priligy Tijuana
Viagra Ohne Rezept Niederlande levitra 40 mga for sale mexico beach Prednisone Without A Scrip
#12
Posted 05/11/2017, 12:34
Hvor Kjope Propecia viagra prescription Actu Viagra Propecia 1o Mg Best Price For Otc Nexium
Viagra Effets Negatifs viagra Bienfaits Du Clomid
Viagra Effets Negatifs viagra Bienfaits Du Clomid
#13
Posted 27/11/2017, 21:32
Amoxicillin Canine generic viagra Side Effects Cephalexin Dogs
Viagra Discount Online viagra Generic Propecia For Sale Levitra Costo Farmacia
Kidney Infections And Amoxicillin buy accutane online fast delivery cialis Ebay Kamagra
Viagra Discount Online viagra Generic Propecia For Sale Levitra Costo Farmacia
Kidney Infections And Amoxicillin buy accutane online fast delivery cialis Ebay Kamagra
1 user(s) are reading this topic
0 membro(s), 1 visitante(s) e 0 membros anônimo(s)