Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

The Database Forum


You are currently viewing our The Database Forum as a guest. Please register to participate.
Login



Reply
INSERT ALL INTO - MS Access SQL supported?
Old 04-26-2006, 05:25 PM INSERT ALL INTO - MS Access SQL supported?
Super Talker

Posts: 129
Trades: 0
Hi all, as the title says, does Access SQL support the Insert All Into statement? I'm doing an ASP website and am trying to enter valued from a form into two lionked tables in an Access database. The standard SQL code would be

INSERT ALL INTO tblParent(name, Address) Values ('Dave','Home')
INTO tblChild(age, phone) Values ('35','1234567');

However, I keep getting a syntax error. If Access doesn't support this, how do I insert into linked tables?

Cheers, Lol
Lol999 is offline
Reply With Quote
View Public Profile Visit Lol999's homepage!
 
 
Register now for full access!
Old 04-26-2006, 05:44 PM Re: INSERT ALL INTO - MS Access SQL supported?
chrishirst's Avatar
Missing! presumed drunk.

Posts: 41,519
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
it will have to be multiple queries.
__________________
Chris. ->> Links are advertising NOT optimising!! <<-
A foolish consistency is the hobgoblin of little minds
Thought for today:- I SEO the only industry where all the cowboys are Indians?
chrishirst is offline
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 04-26-2006, 05:56 PM Re: INSERT ALL INTO - MS Access SQL supported?
Super Talker

Posts: 129
Trades: 0
Right, I wondered if such. Here's the situation:

Parent table has a AutoNumber PK which does not appear on the form from which data is submitted to the database. This is also present in the Child table as the link field. The PK of the Child table is an autonumber which is meaningless to the situation but has to be there to satisfy Access's need for a PK. On trying two separate insert statements would I need to:

Insert into Parent table, thus generating a new record. Extract from that table the PK value, i.e. the autonumber. Then use this as a reference to insert into the Child table using a WHERE clause so that the child record matches the parent one? Make sense?

Cheers, Lol
Lol999 is offline
Reply With Quote
View Public Profile Visit Lol999's homepage!
 
Old 04-27-2006, 04:38 AM Re: INSERT ALL INTO - MS Access SQL supported?
chrishirst's Avatar
Missing! presumed drunk.

Posts: 41,519
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
after the parent insert use a

select @@identity as newid from parent_table

I believe it works in Access and should return the last autonumber field value.
__________________
Chris. ->> Links are advertising NOT optimising!! <<-
A foolish consistency is the hobgoblin of little minds
Thought for today:- I SEO the only industry where all the cowboys are Indians?
chrishirst is offline
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 04-27-2006, 08:41 AM Re: INSERT ALL INTO - MS Access SQL supported?
Super Talker

Posts: 129
Trades: 0
Thanks Chris, will see where it goes!

Cheers, Lol
Lol999 is offline
Reply With Quote
View Public Profile Visit Lol999's homepage!
 
Reply     « Reply to INSERT ALL INTO - MS Access SQL supported?
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.25383 seconds with 12 queries