473,586 Members | 2,652 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

insert with select

if i use the insert to add a new row to the access database, something like:
INSERT INTO tblCat (CatName,CatOrd er,StoreID) VALUES( '" & strNewCat&"', "&
strMaxiO& ", 1);
and there is another column with auto numbering (sorry for my english).
how can i retrive that value, can i use select and insert together?
Nov 13 '05 #1
3 2265
On Sat, 28 May 2005 21:16:31 +0200, "Sagi" <sa**@schieber. net> wrote:

No, you can't use both together. But after the INSERT you can run a
SELECT query to find the inserted record again (assuming there is some
unique combination of values in CatName,CatOrde r,StoreID.
If there isn't you may have a database design problem. Anyway, you
could run a SELECT query for the Max(AutonumberF ield). But that's
dangerous in a multiuser environment.

-Tom.

if i use the insert to add a new row to the access database, something like:
INSERT INTO tblCat (CatName,CatOrd er,StoreID) VALUES( '" & strNewCat&"', "&
strMaxiO& ", 1);
and there is another column with auto numbering (sorry for my english).
how can i retrive that value, can i use select and insert together?


Nov 13 '05 #2
does the insert into query return value?

"Tom van Stiphout" <no************ *@cox.net> wrote in message
news:at******** *************** *********@4ax.c om...
On Sat, 28 May 2005 21:16:31 +0200, "Sagi" <sa**@schieber. net> wrote:

No, you can't use both together. But after the INSERT you can run a
SELECT query to find the inserted record again (assuming there is some
unique combination of values in CatName,CatOrde r,StoreID.
If there isn't you may have a database design problem. Anyway, you
could run a SELECT query for the Max(AutonumberF ield). But that's
dangerous in a multiuser environment.

-Tom.

if i use the insert to add a new row to the access database, something
like:
INSERT INTO tblCat (CatName,CatOrd er,StoreID) VALUES( '" & strNewCat&"',
"&
strMaxiO& ", 1);
and there is another column with auto numbering (sorry for my english).
how can i retrive that value, can i use select and insert together?

Nov 13 '05 #3
On Sat, 28 May 2005 21:56:18 +0200, "Sagi" <sa**@schieber. net> wrote:

No. Only SELECT queries return values.
-Tom.
does the insert into query return value?

"Tom van Stiphout" <no************ *@cox.net> wrote in message
news:at******* *************** **********@4ax. com...
On Sat, 28 May 2005 21:16:31 +0200, "Sagi" <sa**@schieber. net> wrote:

No, you can't use both together. But after the INSERT you can run a
SELECT query to find the inserted record again (assuming there is some
unique combination of values in CatName,CatOrde r,StoreID.
If there isn't you may have a database design problem. Anyway, you
could run a SELECT query for the Max(AutonumberF ield). But that's
dangerous in a multiuser environment.

-Tom.

if i use the insert to add a new row to the access database, something
like:
INSERT INTO tblCat (CatName,CatOrd er,StoreID) VALUES( '" & strNewCat&"',
"&
strMaxiO& ", 1);
and there is another column with auto numbering (sorry for my english).
how can i retrive that value, can i use select and insert together?


Nov 13 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

14
4282
by: serge | last post by:
I have a scenario where two tables are in a One-to-Many relationship and I need to move the data from the Many table to the One table so that it becomes a One-to-One relationship. I need to salvage the records from the many table and without going into detail, one of the reasons I can't do the opposite as there are records in the ONE table...
0
3128
by: jtocci | last post by:
I'm having a big problem with CREATE RULE...ON INSERT...INSERT INTO...SELECT...FROM...WHERE when I want to INSERT several (20~50) records based on a single INSERT to a view. Either I get a 'too much data for field' or the query just runs on and on til I have to restart the postmaster. I have found rules to compare mine to but people limit...
16
16995
by: Philip Boonzaaier | last post by:
I want to be able to generate SQL statements that will go through a list of data, effectively row by row, enquire on the database if this exists in the selected table- If it exists, then the colums must be UPDATED, if not, they must be INSERTED. Logically then, I would like to SELECT * FROM <TABLE> WHERE ....<Values entered here>, and then...
0
4482
by: ImraneA | last post by:
Hi there I had pleasure of upsizing Access v97 db to Access v2K/SQL 2K. Wish to provide some knowledge gained back to community - hopefully help others. 1.Question how do you test stored procedure from SQL Server vs MS Access point of view ?
4
5471
by: Chris Kratz | last post by:
Hello all, We have run into what appears to be a problem with rules and subselects in postgres 7.4.1. We have boiled it down to the following test case. If anyone has any thoughts as to why this would be happening, we would appreciate feedback. We have tested on 7.3.4, 7.3.6 and 7.4.1 and all exhibit the same behavior. Test case one...
20
18330
by: Mark Harrison | last post by:
So I have some data that I want to put into a table. If the row already exists (as defined by the primary key), I would like to update the row. Otherwise, I would like to insert the row. I've been doing something like delete from foo where name = 'xx'; insert into foo values('xx',1,2,...);
0
2279
by: magnolia | last post by:
i created a trigger that will record the changes made to a table .everything works fine except the insert query.whenerever i try to insert a record it fires insert and update triger at the same time which means i hav 2 record for every insert operation. any help appreciated. thank u herez teh code i tried. ALTER TRIGGER...
0
1659
by: gpspocket | last post by:
help me -CURSOR backward insert from End Date > to Start Date how to insert dates from end to start like this SELECT 111111,1,CONVERT(DATETIME, '17/03/2008', 103), CONVERT(DATETIME, '01/03/2008' i explain i have stord prosege that create mod cycle shift pattern and it working ok
6
3712
by: lenygold via DBMonster.com | last post by:
Hi everybody: What is the best way to I have 10 tables with similar INSERT requiremnts. INSERT INTO ACSB.VAATAFAE WITH AA(AA_TIN, AA_FILE_SOURCE_CD, .AA_TIN_TYP) AS ( SELECT AA_TIN, AA_FILE_SOURCE_CD, .AA_TIN_TYP FROM VAATAFAA WHERE AB_TP_ACNT_STAT_CD <0),
1
2645
by: EJO | last post by:
with sql 2000 enterprise Trying to build a stored procedure that will take the rows of a parent table, insert them into another table as well as the rows from a child table to insert into another table and be able to maintain the relationships between the parent/child rows of the new records. Something like old_id new_id
0
7912
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7839
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
6614
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5710
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5390
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3837
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
1
2345
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1449
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1180
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.