473,387 Members | 1,899 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Two or more columns act as one unique column

Hi people, I thought I had a simple problem ahead of me but it turns out it ain't that simple as I hoped it would be. So here is the problem:
I've got a table in a dataset which acts like a join table to other parent tables making a many to many relation.
Got two foreign keys in it which are related to their master tables, problems is I want to make the combination of the two foreign keys act like an unique entry.
To be more precise, example:
Table1: Employes, which contains every employee
Table2: Months: which contains months of the year like id=number of month name=the name of the month
Table3: the link between the two tables contains keys which relate to the id of the employee and the id of the month, my problem is I wanna restrict user from entering the same employee with the same month, t.i. an employee with id=1 and a month with id=1 can be written in Table3 only once. I thought i had some solution for this but my efforts failed.
Thanks in advance
Sep 19 '08 #1
2 1095
Plater
7,872 Expert 4TB
Does this table exist on the database server, or only in your code?
On the server you would just make a new unique key with the two columns.
I imagine there is some type of similar functionality in the DataSets, although I don't know for sure.
Sep 19 '08 #2
Sorry for the late reply:(
Yeah I am aware of the ability to make more columns act as a unique key in any relational database, that is why i was hoping this will be an easy task.What I really need is to make this sort of action in the dataset designer. I am not working with an actual database, I was trying to work in a disconnected mode all my tables are created in the xsd designer and I don't have a database connection. Was searching for this option, but I cant find it.
Thanks again
Sep 22 '08 #3

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

Similar topics

2
by: adammitchell | last post by:
How can you indicate that a FOREIGN KEY constraint references two columns in two different tables? "SQL Server Books Online" show an example of how to reference two columns in the SAME table:...
8
by: Arpan | last post by:
How do I find out how many columns exist in a SQL Server DB table before displaying the records of that table? Also how do I get all the column names as an array so that I can seperate each...
6
by: alederer | last post by:
Hallo! I have a table tstest(ts char(13) for bit data constraint a unique). This column is filled in a trigger with generate_unique(). In a application (CLI), I have the values of this...
2
by: Greg Linwood | last post by:
I'm using a Data Grid and want to apply wider spacing between columns than rows. As such, cellspacing / padding aren't any use to me. I used to do this in html tables by simply adding columns...
6
by: zaphod | last post by:
I need to select unique combinations of 4 columns from one table and insert them into a new table but I can't think of any way of finding unique combinations of more than 1 column since SELECT...
4
by: Jeff | last post by:
I am stuck on trying to generate two columns headers for a datagrid on form load. I can use a datatable as the datasource and get the results I want, but I want to set different column widths and...
8
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...
1
by: James | last post by:
To alter 1 column to a unique key, ALTER TABLE user MODIFY COLUMN id INT NOT NULL UNIQUE; But how to set combination of 2 columns as a unique key? Individual keys are not unique, but...
8
by: Sham | last post by:
I am trying to perform the following query on a table that has been indexed using Full Text Search. The table contains multiple columns than have been indexed. (Below, all xml columns are...
1
by: raghavv | last post by:
Hi, How do you implement unique constraint on 2 columns.i.e consider i have 3 column id,name and active.If the there is a row in a table with 1,apple,true than it should not allow the entry of...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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,...

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.