473,566 Members | 3,309 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

insert into primary froeigon key relationship

10 New Member
Hi every one
i want to insert into tx_category table data coulmn cat_type while selecting existing types from tx_type table.these two table are linked primary foreigon key relationship

INSERT INTO TX_CATEGORY(CAT _ID, STATUS_VALUE,CA T_NAME,CAT_PRIM ARY_TITLE,CAT_T YPE,CAT_PRIMARY TEXT,CAT_PRIMAR YCONTEXT,SRC_ID ,CAT_SECONDARY_ TITLE,CAT_PRIMA RY_INDEX,CAT_UP DATEDBY,CAT_UPD ATEDON,CAT_CREA TEDBY,CAT_CREAT EDON) VALUES((select NVL(MAX(CAT_ID) ,1) + 1 from TX_CATEGORY),'" + Is_StatVal + "','" + Is_CatName + "','" + Is_pTitle + "','"+Is_CatTyp e +"','" + Is_pText + "','" + Is_pContext + "','" + Is_srcID + "','" + Is_sTitle + "','" + Is_pIndex + "','" + Is_UpdatedBy + "','" + Is_UpdatedOn + "','" + Is_CreatedBy + "','" + Is_CreatedOn + "')";
Aug 20 '08 #1
2 1479
r035198x
13,262 MVP
Did you get an error with that then?
Aug 20 '08 #2
debasisdas
8,127 Recognized Expert Expert
you need to insert to parent table first then only you can insert to child table to enforce rule of REFERENTIAL INTEGRITY.
Aug 20 '08 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

14
4275
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...
3
4488
by: Nicolae Fieraru | last post by:
Hi All, I have a problem and I can't figure out how to solve it. My database has three tables: tblCustomers, with CustomerId and CustomerName tblProducts, with ProductId and ProductCode tblPurchases, with PurchaseId, CustomerId and ProductId I created a form with a subform which shows all the customers, one at a time
1
6299
by: tabonni | last post by:
Hi all I created two tables - Employee and Folder using MS Access 2002. Inside Employee table, I got 3 fields: EmployeeID (Data Type:Autonumber) Username (Data Type: Text) Password (Data Type: Text)
8
9222
by: Bri | last post by:
Greetings, I'm having a very strange problem in an AC97 MDB with ODBC Linked tables to SQL Server 7. The table has an Identity field and a Timestamp field. The problem is that when a new record is entered, either from a form or from the table view of the table, when the record gets saved it immediately displays #DELETED# in all of the...
3
4319
by: Hai Nguyen | last post by:
Hi all I was attempting to insert multiple row by using a loop into a database.A table has 2 primary keys and one regular field (PR) (PR) ID Project Ans 1 2 a 1 3 b 1 4 c 1 5 d
8
31523
by: Paul Hunter | last post by:
I am new to databases and thus to Access. I have a situation where I am trying to figure out how to key some tables I am working with. Consider that I have a database of my own records which are invoices I work on. These invoices are from four companies with their own invoice numbers. So, I cannot key by invoice number because there is a...
4
5083
by: Robert Ludig | last post by:
I have a Table that contains Items of the Type "Step". The primary key is "StepID". Each step can have have a target step, wich represents a subsequent step. So I have a Foreign key relationship within the same table: Primary Key: StepID --> Foreign Key: TargetStepID Now if I want to insert a group of new Steps into the table, I can only...
2
1972
by: cday119 | last post by:
Can someone help me out with this one. I am trying to insert a row of data into an access database. The primary key is set to auto increment. It will work once but the next time you try an insert it says. "The changes you requested to the table were not successful because they would create duplicate values in the index, primary key, or...
2
7327
by: ksenthilbabu | last post by:
Hey All, I am using MSSQL -2005 with VB6. I have created a master table tblCompany and detail Table tblDetail having foreign key relationship. When i try to insert a value within a TRANSACTION I am getting Error No. -2147217873 at Line No. 0 (The INSERT statement conflicted with the FOREIGN KEY constraint "FK_tblDetail_tblCompany". The...
0
7673
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
7893
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8109
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7645
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
6263
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...
0
3626
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2085
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
1202
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
926
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.