Problem Creating FOREIGN Key
Jul 20, 2005
Hi,
I am using SQL Server 7.0
TABLE1
======
Fld1
Fld2
Fld3
Fld4
Fld5
Fld6
Primary Key = Fld1 + Fld2 + Fld3
TABLE2
======
Fld1
Fld2
Fld3
Fld4
Fld5
Foriegn Key = Fld5 (Referencing TABLE1.Fld3) The datatypes are
matching in both tables.
I am trying to create the foreign key by giving the following command:
ALTER TABLE TABLE2 ADD
CONSTRAINT [FK_TABLE2_TABLE1] FOREIGN KEY
(
[Fld5]
) REFERENCES TABLE1 (
[Fld3]
)
GO
This is giving the following error:
There are no primary or candidate keys in the referenced table
'TABLE1' that match the referencing column list in the foreign key
'FK_TABLE2_TABLE1'.
Any help?
Regards,
Kamlesh
View 2 Replies
ADVERTISEMENT
Aug 1, 2007
I have two tables; each has multi-column primary keys. I need to create a foreign key relationship between the two tables.
Sales:
DKey, int, PK
OKey,int, PK
RKey,int, PK
...
Rep:
Bkey, int, PK, identity
Rkey, int, PK
...
When I try to like Rkey from both tables as a foreign key relationship, I get an error that the columns in one table "do not match an existing primary key or UNIQUE constraint. (I've tried it both ways and get the same error.)
How can I link these two tables?
Thanks.
View 7 Replies
View Related
Feb 21, 2015
CREATE TABLE IssueLog (
ItemNo int NOT NULL IDENTITY PRIMARY KEY
REFERENCES IssueProgress (ItemNo)
ON UPDATE CASCADE
ON DELETE CASCADE,
REFERENCES Approvals(ItemNo)
ON UPDATE CASCADE
ON DELETE SET NULL,
Msg 142, Level 15, State 2, Line 0
Incorrect syntax for definition of the 'TABLE' constraint.
I'd like to update or delete the IssueProgress plus update and setting null to the Approvals tables at the same time whenever the ItemNo of the parent table namely IssueLog is updated or deleted.
How can I achieve this?
View 1 Replies
View Related
Feb 8, 2007
Hello, I'm having some problems trying to create this foreign key constraint:
ALTER TABLE dbo.t2_demaclie
ADD CONSTRAINT FK03_T2_DEMACLIE FOREIGN KEY (dclPerfilCompania, dclOrdenPedido)
REFERENCES DBO.T2_PEDIDOCLIENTE (cdPerfilCompania, nmOrdenPedido)
Server: Msg 547, Level 16, State 1, Line 1
ALTER TABLE statement conflicted with TABLE FOREIGN KEY constraint 'FK03_T2_DEMACLIE'. The conflict occurred in database 'Comfruta_dllo', table 't2_pedidoCliente'.
I'm sure there's no other constraint with the same name, and there's no othe one with the same columns...
Thanks a lot !!
View 6 Replies
View Related
Jul 16, 2007
Hey everyone,
I have just started getting into to SQL and am completely brand new to the whole concepts of relational databases. Someone on this forum pointed to the MSDN videos on LEARNVISUALSTUDIO.NET which have been very helpful. Unfortunately while learning about relational databases and looking at the program that I want to design and make using them, I have run into a pretty big wall, concerning the primary key and foreign key.
For my program, I am trying to save an object, and lets say the base class is SLIDE. Now SLIDE will store basically most of the information that I will ever want to store, such as timeCreated and mainText and slideID(primarykey). But there are other classes that derive from slide that will store just a bit more information than that because of what they are. Lets say there is a class derived from SLIDE called PERSON that stores its parentNode, which is to say something that this slide specifically belongs to and has a reference to. Now the tricky part is that in this program, every single slide can have a reference to another slide, that you would see displayed and that you could just click on and view if you wanted to.
Now relating what I just told about the classes in my program to a relation database standpoint is what confuses me. If I make a table SLIDE, it would hold incomplete data about the PERSON object, because that object has more data than SLIDE has. The answer to this was to make another table called PERSON, which would have more columns. But now we arrive at the big problem: The primary key called maybe SLIDEID would be different in this new PERSON table than in the other table called SLIDE (or any other derived class). Therefore the link between these tables is messed up. In my object orientated mind I am thinking of static class variables that would still stay constant for derived classes, so that when I make a PERSON slide it will increment off of the primary key of the SLIDE table. In other words, is there some sort of super TABLE that you can derive from, like an abstract class, where the primary keys of other tables can build off of because they will be used as the same type of reference to eachother.
If none of this made sense to the reader, I am greatly sorry. I do not really know what else I can say to convey to you the problem I have. Maybe its because I am so used to object orientated languages that this is making it so difficult to explain. If however you do understand what I am talking about, please think about it and help me find a solution to this problem. I am not an experienced programmer, but I do very much enjoy it and I am very excited about starting to make this program, and I have learned that before I start coding it is very important to have a very firm design in mind first.
Thank your for reading,
Jeremy
View 5 Replies
View Related
Jun 19, 2002
I have the following tables in an SQL Server database.
Contact
=======
NameID
TitleID
Name
JobTitle
========
TitleID
Title
I'm trying to make a form to add entries to the Contact table that lets me associate a job title to a name by choosing it from a drop down list. I have been able to make it so I get a drop down list of TitleID but I need the Title field displayed. I haven't been able to do it. Does anyone have any tips on how to do this?
View 1 Replies
View Related
Oct 7, 2015
I'm shredding the below xml into relational tables. Each element of the xml has it's own table and there is a foreign key to join the tables, you can see this in the below picture. The process I follow is each relational table I always bring the nesecary xml and store it in the table and when shredding I always look at the parent table.So for example when processing the seat table, I use seat xml from the parent route table, also taking the ROUTEID from the route table. The reason I do this is all about taking the id from the previous step to create the relationships between the tables. without taking the xml down to the tables?The problem with this approach is I have xml stored in most tables and the tables are becoming very large.
<Route Type="OneWay" >
<Seat Type="FirstClass">
<Prices>
<Price Price="10" />
<Price Price="11" />
</Prices>
[code]....
View 4 Replies
View Related
Apr 11, 2006
Hello again,
I'm going through my tables and rewriting them so that I can create relationship-based constraints and create foreign keys among my tables. I didn't have a problem with a few of the tables but I seem to have come across a slightly confusing hiccup.
Here's the query for my Classes table:
Code:
CREATE TABLE Classes
(
class_id
INT
IDENTITY
PRIMARY KEY
NOT NULL,
teacher_id
INT
NOT NULL,
class_title
VARCHAR(50)
NOT NULL,
class_grade
SMALLINT
NOT NULL
DEFAULT 6,
class_tardies
SMALLINT
NOT NULL
DEFAULT 0,
class_absences
SMALLINT
NOT NULL
DEFAULT 0,
CONSTRAINT Teacher_instructs_ClassFKIndex1 FOREIGN KEY (teacher_id)
REFERENCES Users (user_id)
)
This statement runs without problems and I Create the relationship with my Users table just fine, having renamed it to teacher_id. I have a 1:n relationship between users and tables AND an n:m relationship because a user can be a student or a teacher, the difference is one field, user_type, which denotes what type of user a person is. In any case, the relationship that's 1:n from users to classes is that of the teacher instructing the class. The problem exists when I run my query for the intermediary table between the class and the gradebook:
Code:
CREATE TABLE Classes_have_Grades
(
class_id
INT
PRIMARY KEY
NOT NULL,
teacher_id
INT
NOT NULL,
grade_id
INT
NOT NULL,
CONSTRAINT Grades_for_ClassesFKIndex1 FOREIGN KEY (grade_id)
REFERENCES Grades (grade_id),
CONSTRAINT Classes_have_gradesFKIndex2 FOREIGN KEY (class_id, teacher_id)
REFERENCES Classes (class_id, teacher_id)
)
Query Analyzer spits out: Quote: Originally Posted by Query Analyzer There are no primary or candidate keys in the referenced table 'Classes' that match the referencing column list in the foreign key 'Classes_have_gradesFKIndex2'. Now, I know in SQL Server 2000 you can only have one primary key. Does that mean I can have a multi-columned Primary key (which is in fact what I would like) or does that mean that just one field can be a primary key and that a table can have only the one primary key?
In addition, what is a "candidate" key? Will making the other fields "Candidate" keys solve my problem?
Thank you for your assistance.
View 1 Replies
View Related
Jul 16, 2014
what the best practice is for creating indexes on columns that are foreign keys to the primary keys of other tables. For example:
[Schools] [Students]
---------------- -----------------
| SchoolId PK|<-. | StudentId PK|
| SchoolName | '--| SchoolId |
---------------- | StudentName |
-----------------
The foreign key above is as:
ALTER TABLE [Students] WITH CHECK ADD CONSTRAINT [FK_Students_Schools]
FOREIGN KEY([SchoolId]) REFERENCES [Schools] ([SchoolId])
What kind of index would ensure best performance for INSERTs/UPDATEs, so that SQL Server can most efficiently check the FK constraints? Would it be simply:
CREATE INDEX IX_Students_SchlId ON Students (SchoolId)
Or
CREATE INDEX IX_Students_SchlId ON Students (SchoolId, StudentId)
In other words, what's best practice for adding an index which best supports a Foreign Key constraint?
View 4 Replies
View Related
Jan 28, 2008
Hi,
If I want to automatically insert a record which has default value in a table,
how can I create the trigger?
View 5 Replies
View Related
Dec 27, 2003
Hello,
I want to make a poll and have to use a foreign key in my database. This is not possible in Web Matrix so I have to use SQL Enterprise Manager. But don't know how. I read the help but can't figure it out. Can someone help me??? Thanks in advance.
Regards,
Roel Alblas
View 5 Replies
View Related
Sep 14, 1998
Hi!
Is it possible in SQL 6.5 to create a Foreign Key on a field that
has a datatype of SMALLINT? I have created FK`s with
other datatypes, but it doesn`t seem to work with this particular
datatype. Is there some trick to this?
Thank you for your assistance!
Toni
View 2 Replies
View Related
Mar 30, 2006
When you set a foreign key to reference a primary key on another table, does the foreign key automatically update? Can anyone explain just how to make a relational table from just the nuts and bolts SQL statements.
View 1 Replies
View Related
Dec 20, 2004
Hi there,
I'm trying to make a few tables in SQL (First time user). The tables have been derived from a logical model based around my assignment...
I'm having problem getting two foreign keys in one table in the SQL. I keep getting the duplicate foreign key error...
I'm not sure where i'm going wrong.....
http://img.photobucket.com/albums/v294/Jertsy/Agh.jpg
there’s a pic of my tables.... There are 4 tables, blog, blogger, blog_entry, and comment.. Blog is only table without a FK.
have a look & thanks for any and all help....
Spencer.
View 1 Replies
View Related
Jun 23, 2007
Hi Friends,Is there any way to get the table name which is referenced by theforeign keyfor example: consider two table "Staff" and "Department"Staff with following columnsPK_IDFK_DepartmentIDNameAddressDepartment with following columnsPK_DepartmentIDDeptNameActually what i need is: Initially i would be having the table name as"Staff"from Staff table i need to identify that the column FK_DepartmentID isa foreign keyand the primary key is in the Department tablei need to traverse from Staff table and identify that FK_DepartmentIDis a primary key in Department tablethis has to be accomplished by sql query.... probably this could befetched fromData Dictionary but i couldnt find the relationship between the systemtables.ThanksArunDhaJ
View 1 Replies
View Related
Jun 5, 2007
I would like to create a foreign key but the Primary table has 2 fields as it Primary Key. Is there a way to create a Foreign Key that links only on one field of the primary key.
Ex: table 1: id int , language char(2), description varchar(100) PK = ID + language
table 2 : id int, idlanguage int PK = id FK (idLanguage refers to id from table 1)
This cause an error because the foreign key does not include all part of the primary key.
Rufen
View 3 Replies
View Related
Jan 4, 2008
table1
-------
a1 number(10) PK
b1 varchar2(3)
c1 number(10)
Table2
----------
d1 number(10) PK
b1 varchar2(3)
c1 number(10)
Can I make a Foreign key from Table2(b1,c1) to table1(b1,c1) if b1 in table1 might be null.
When I tried that I got this.
ORA-02270: no matching unique or primary key for this column-list
View 6 Replies
View Related
Apr 13, 2008
Hi everyone,
My main table has a column named "customer" which is a foreign key pointed to my secondary table consisted of a column "customer_id".
I wanted to change my secondary table's customer_id's name into another name whereby deleting it and create a new column instead (i dont know another way of changing names by code) but i'm not allowed to do that due to "customer_is"'s being attached to my main table as FK.
Any suggestion how to do it ?
Thanks a lot.
View 9 Replies
View Related
Aug 10, 2007
i want to make primary key and foreign key relationship of table A1 and table B1 but A1 exist in database A and B1 exist in database B
column name u can pretain as C1, C2
View 5 Replies
View Related
Aug 8, 2006
I am deleting a column from a table in code. Before I drop the colum I need to find if the column belongs to a foreign key. I have the names of the foreign keys for the table from sysobjects.How can I determine what columns are part of the foreign key?
View 9 Replies
View Related
Oct 5, 2006
Just installed this the Forum starter Kit and am getting this message when I try to add the first threadI'm a bit of a newbie but not only damp behind the earsThe INSERT statement conflicted with the FOREIGN KEY constraint "FK_MembersForums_MemberInfo". The conflict occurred in database "SQL2005_****_*****01", table "dbo.MemberInfo", column 'memberid'.The statement has been terminated. What do I need to do to the SQL Tables in order to get this to work?
View 3 Replies
View Related
Nov 9, 2006
Hi, i have 3 tables.
Orders: {OrderNr(PK, autonumber), date}
Order_Line: {OrderNr(FK), ItemNr(FK), number}
Items: {ItemNr(PK), Name, ...}
How do I insert a new Order with a new order_line? I get this error: The INSERT statement conflicted with the FOREIGN KEY constraint
I can't figure out how to capture the autogenerated OrderNr.
View 1 Replies
View Related
Apr 17, 2007
Can any body tell me how to know to what columns of other table it refers to.
shiva kumar
View 2 Replies
View Related
Apr 27, 2007
I have a one to many relationship between two tables. The master table is keyed using an int ID field set to IsIdentity yes and this is the primary key. The field name is ChurchID. Likewise the detail table has such a field as it's primary key and is named ContactID.
I carry the ChurchID field in the detail table and would like to make it the foreign key. I could not find this explained in the two books I have and the help was anything but that )perhaps it's just me afterall).
Well, any help in this matter would be greatly appreciated as I find myself at a standstill until this can be resolved.
Thanks in advance.
View 2 Replies
View Related
Jul 3, 2007
When I try to insert a record on my DB (SQL 2005 Express) I get a constraint error. This is my table setup which has been simplified to expose the problem I have:
Categories TABLEint CatId PKvarchar CatName :
Items TABLEint ItemId PKvarchar ItemName :
X_Items_Categoriesint CatIdint ItemId
So basically I have a one-to-many relationship between Items and Categories, in other words each item is associated to one or more categories and this association is done via the X_Items_Categories cross table. On this cross table I set two constraints:
The CatId of each entry in the cross table (X_Items_Categories) must exist in the Category table, and
View 4 Replies
View Related
Nov 30, 2007
I am new beginner for SQL .I have requirement of using foreign key in tables I have created earlier.Can anyone tell me the syntax for the same ?
Please help me, Your suggestions are welcome.
View 6 Replies
View Related
Mar 13, 2008
I'm trying to enter data into a SqlServer 2005 database programatically. The databases are part of an open source program I have. I'm encountering the following error when I try to enter data into a particular table:The INSERT statement conflicted with the FOREIGN KEY constraint "FK_CMRC_ProductImages_CMRC_Products". The conflict occurred in database "hscom", table "dbo.CSK_Store_Product", column 'productID'. The statement has been terminated. I understand what's happening theoretically, but I don't know where to look for where the constraint is defined, or how to fix it. I don't see FK_CMRC_ProductImages_CMRC_Products as a file name or a stored procedure. Diane
View 3 Replies
View Related
Apr 7, 2008
tell me how to add foreign keys in sql 2005 express
View 3 Replies
View Related
Apr 26, 2004
Hi
Can anyone tell me how I can remove a foreign key in a SQL database?
Thanks in advance
View 4 Replies
View Related
Sep 24, 2004
Hi;
I have 2 tables Users and DVDTestResults these tables have a relation over UserID
Users.UserID
DVDTestResults.UserName
both char
But when I try to insert in DVDTestResults I am having an error:
INSERT statement conflicted with COLUMN FOREIGN KEY constraint 'FK_DVDTestResults_Users'. The conflict occurred in database 'Test', table 'Users', column 'UserID'. The statement has been terminated.
can you help me why?
thank you....
View 7 Replies
View Related
Aug 12, 2005
I'm using stored procedures to update my tables. If I disable the foreign key constraint all works perfectly. Otherwise I get this error:INSERT statement conflicted with TABLE FOREIGN KEY constraint 'FK_wansub_invoice'. The conflict occurred in database 'test1', table 'invoice'. The statement has been terminated. I don't understand why I'm getting the error, because when I disable the constraint even the foreign key fields are updated properly and there is no apparent conflict with the linked table. I've included my c# code and the stored procedure below.FYI the foreign keys in question are InvoiceDate, AccountNum, CarrierId, and Cycle. These are the primary keys in the "invoice" table, and foreign keys in the "wansub" table. It is vital that all records in the wansub table are matched with a record in the invoice table, so I have to have this constraint in place. C# code to create parameters and call the sp:
public int updateWanTable(WanSubaccount sub, Invoice invoice)
{
SqlCommand cmdUpdateWan;
int returnvalue = 0;
cmdUpdateWan = new SqlCommand("usp_updatewan", conn);
cmdUpdateWan.CommandType = CommandType.StoredProcedure;
SqlParameter invoicedate = cmdUpdateWan.Parameters.Add("@InvoiceDate", SqlDbType.SmallDateTime);
invoicedate.Value = DateTime.Parse(invoice.InvoiceDate.Trim());
SqlParameter subaccountnumber = cmdUpdateWan.Parameters.Add("@SubaccountNumber", SqlDbType.VarChar, 50);
subaccountnumber.Value = sub.SubaccountNumber.Trim();
SqlParameter addressa = cmdUpdateWan.Parameters.Add("@AddressA", SqlDbType.VarChar, 50 );
addressa.Value = sub.Address.Trim();
SqlParameter citya = cmdUpdateWan.Parameters.Add("@CityA", SqlDbType.VarChar, 50 );
citya.Value = sub.City.Trim();
SqlParameter statea = cmdUpdateWan.Parameters.Add("@StateA", SqlDbType.VarChar, 50 );
statea.Value = sub.State.Trim();
SqlParameter zipa = cmdUpdateWan.Parameters.Add("@ZipA", SqlDbType.NChar, 10 );
zipa.Value = sub.Zip.Trim();
SqlParameter countrya = cmdUpdateWan.Parameters.Add("@CountryA", SqlDbType.VarChar, 50 );
countrya.Value = sub.Country.Trim();
SqlParameter addressb = cmdUpdateWan.Parameters.Add("@AddressB", SqlDbType.VarChar, 50 );
addressb.Value = sub.AddressB.Trim();
SqlParameter cityb = cmdUpdateWan.Parameters.Add("@CityB", SqlDbType.VarChar, 50 );
cityb.Value = sub.CityB.Trim();
SqlParameter stateb = cmdUpdateWan.Parameters.Add("@StateB", SqlDbType.VarChar, 50 );
stateb.Value = sub.StateB.Trim();
SqlParameter zipb = cmdUpdateWan.Parameters.Add("@ZipB", SqlDbType.NChar, 10 );
zipb.Value = sub.ZipB.Trim();
SqlParameter countryb = cmdUpdateWan.Parameters.Add("@CountryB", SqlDbType.VarChar, 50 );
countryb.Value = sub.CountryB.Trim();
SqlParameter speed = cmdUpdateWan.Parameters.Add("@Speed", SqlDbType.VarChar, 50 );
speed.Value = sub.Speed.Trim();
SqlParameter type = cmdUpdateWan.Parameters.Add("@Type", SqlDbType.VarChar, 50 );
type.Value = sub.Type.Trim();
SqlParameter monthlycharge = cmdUpdateWan.Parameters.Add("@MonthlyCharge", SqlDbType.Money );
monthlycharge.Value = sub.MonthlyServiceFee;
SqlParameter discounts = cmdUpdateWan.Parameters.Add("@Discounts", SqlDbType.Money );
discounts.Value = sub.Discounts;
SqlParameter other = cmdUpdateWan.Parameters.Add("@Other", SqlDbType.Money );
other.Value = sub.Other;
SqlParameter ucc = cmdUpdateWan.Parameters.Add("@UCC", SqlDbType.Money );
ucc.Value = sub.Ucc;
SqlParameter fedtax = cmdUpdateWan.Parameters.Add("@FedTax", SqlDbType.Money );
fedtax.Value = sub.FedTax;
SqlParameter statetax = cmdUpdateWan.Parameters.Add("@StateTax", SqlDbType.Money );
statetax.Value = sub.StateTax;
SqlParameter othertax = cmdUpdateWan.Parameters.Add("@OtherTax", SqlDbType.Money );
othertax.Value = sub.OtherTax;
SqlParameter accountnum = cmdUpdateWan.Parameters.Add("@AccountNum", SqlDbType.VarChar, 50 );
accountnum.Value = invoice.AccountNumber.Trim();
SqlParameter carrierid = cmdUpdateWan.Parameters.Add("@CarrierId", SqlDbType.Int );
carrierid.Value = invoice.CarrierId;
SqlParameter isthirdparty = cmdUpdateWan.Parameters.Add("@IsThirdParty", SqlDbType.Bit );
isthirdparty.Value = sub.IsThirdParty;
SqlParameter thirdparty = cmdUpdateWan.Parameters.Add("@ThirdPartyBillingCompany", SqlDbType.VarChar, 50 );
thirdparty.Value = sub.ThirdPartyBillingCompany.Trim();
SqlParameter var = cmdUpdateWan.Parameters.Add("@Comments", SqlDbType.VarChar, 255 );
var.Value = sub.Comments.Trim();
SqlParameter notes = cmdUpdateWan.Parameters.Add("@Notes", SqlDbType.VarChar, 255 );
notes.Value = sub.Notes.Trim();
SqlParameter cycle = cmdUpdateWan.Parameters.Add("@Cycle", SqlDbType.Int );
cycle.Value = invoice.Cycle;
// try
// {
conn.Open();
// }
// catch{
//
// }
// try{
returnvalue = cmdUpdateWan.ExecuteNonQuery();
// }
// catch(SqlException e){
// returnvalue = 2;
// }
// finally{
conn.Close();
fill(this);
// }
return returnvalue;
}The SP:CREATE PROCEDURE usp_updatewan( @InvoiceDate smalldatetime, @SubaccountNumber varchar(50), @AddressA varchar(50), @CityA varchar(50), @StateA varchar(50), @ZipA nchar(10), @CountryA varchar(50), @AddressB varchar(50), @CityB varchar(50), @StateB varchar(50), @ZipB nchar(10), @CountryB varchar(50), @Speed varchar(50), @Type varchar(50), @MonthlyCharge money, @Discounts money, @Other money, @UCC money, @FedTax money, @StateTax money, @OtherTax money, @AccountNum varchar(50), @CarrierId int, @IsThirdParty bit, @ThirdPartyBillingCompany varchar(50), @Comments varchar(255), @Notes varchar(255), @Cycle int)
AS
if exists ( select * from wansub where InvoiceDate = @InvoiceDate and SubaccountNumber = @SubaccountNumber and AccountNum = @AccountNum and CarrierId = @CarrierId and Cycle = @Cycle ) Begin --if the record exists update wansub set AddressA = @AddressA, CityA = @CityA, StateA = @StateA, ZipA = @ZipA, CountryA = @CountryA, AddressB = @AddressB, CityB = @CityB, StateB = @StateB, ZipB = @ZipB, CountryB = @CountryB, Speed = @Speed, Type = @Type, MonthlyCharge = @MonthlyCharge, Discounts = @Discounts, Other = @Other, UCC = @UCC, FedTax = @FedTax, StateTax = @StateTax, OtherTax = @OtherTax, IsThirdParty = @IsThirdParty, ThirdPartyBillingCompany = @ThirdPartyBillingCompany, Comments = @Comments, Notes = @Notes EndElse Begin
insert into wansub values (@InvoiceDate, @SubaccountNumber, @AddressA, @CityA, @StateA, @ZipA, @CountryA, @AddressB, @CityB, @StateB, @ZipB, @CountryB, @Speed, @Type, @MonthlyCharge, @Discounts, @Other, @UCC, @FedTax, @StateTax, @OtherTax, @AccountNum, @CarrierId, @IsThirdParty, @ThirdPartyBillingCompany, @Comments, @Notes, @Cycle)
EndGOAny help is greatly appreciated! Especially since I have other tables with this very problem as well . . .
View 4 Replies
View Related
Feb 20, 2006
Hi
I have a one to many relationship between two MS SQL tables.
When inserting a record in the master table (primary key is autoinc) how can I get this value for setting in the foreign key details table?
TIA
View 9 Replies
View Related
Mar 20, 2006
i have 3 table which is merchant, merchantcategory and merchantitem.
merchantcategory's foreign key is refer to merchant_id, and merchantitem's foreign key is refer to merchantcategory_id......
the problem is like this....
i would like to select all the available items from merchantitem, but i only have the information of merchant_id, so what method should i use to get these output ??
i am using the functions which generated by codesmith with wilson ORMapper method.....
i really hope that someone will provide me the solution......thanks
View 2 Replies
View Related