MS SQL Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsDatabasesMS SQL Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
AT&T devCentral & BlackBerry(r) Webcast Series: BlackBerry and GPS -Build Location Awareness into your BlackBerry Applications, July 10th-1:00PM EST. Register Today!
  #1  
Old September 15th, 2004, 11:33 PM
docjay docjay is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2004
Posts: 1 docjay User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Insert ???

Sorry for this basic question but I just want to make sure I am using the best possible technique. My question is on inserting data into two tables from one form. The tables are a "Coach" table and a "Address" table. The "Coach" table contains a foreign key from the "address" table that has a primary key, which is incremental. How do I get that foreign key in the "Coach" table to equal the primary key in the "Address" table which in auto added and incremented by 1??
Do I need to use 2 insert statements or can I do it with just one?
The only way I can think is to insert the address info first and then run a query to find out what value the primary key was assigned. Then insert that value into the "Coach" table to link it back to the address. I hope that someone can follow this mess. Thanks in advance for any assistants.

Reply With Quote
Reply

Viewing: Dev Shed ForumsDatabasesMS SQL Development > Insert ???


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway