473,626 Members | 3,292 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Unique constraint Bug ????

Hi all

i have a problem with my sql dataadapter, i think.
i have this table below ( Script ) and this table has one particularity, it
has 2 unique constraints.

when i´m filling my datatable using my dataadapter, the datatable only have
one ???

is there any workarround for it, besides do it by code ???

thsk
JSB


CREATE TABLE [dbo].[xTable] (
[Test0] [char] (10) COLLATE Latin1_General_ CI_AS NOT NULL ,
[Test1] [char] (10) COLLATE Latin1_General_ CI_AS NULL ,
[Test2] [char] (10) COLLATE Latin1_General_ CI_AS NULL ,
[Test3] [char] (10) COLLATE Latin1_General_ CI_AS NULL ,
[Test4] [char] (10) COLLATE Latin1_General_ CI_AS NULL
) ON [PRIMARY]
GO

ALTER TABLE [dbo].[xTable] ADD
CONSTRAINT [PK_xTable] PRIMARY KEY CLUSTERED
(
[Test0]
) ON [PRIMARY] ,
CONSTRAINT [IX_xTable] UNIQUE NONCLUSTERED
(
[Test0],
[Test1]
) ON [PRIMARY] ,
CONSTRAINT [IX_xTable_1] UNIQUE NONCLUSTERED
(
[Test2],
[Test3],
[Test4]
) ON [PRIMARY]
GO

Aug 10 '05 #1
4 1371
Please don't cross-post to non SQL related NG, post SQL questions to a SQL
related NG's like this portugese NG microsoft.publi c.pt.sql.

Willy.
"João Santa Bárbara" <jo****@i24port ugal.com> wrote in message
news:uK******** ******@tk2msftn gp13.phx.gbl...
Hi all

i have a problem with my sql dataadapter, i think.
i have this table below ( Script ) and this table has one particularity,
it has 2 unique constraints.

when i´m filling my datatable using my dataadapter, the datatable only
have one ???

is there any workarround for it, besides do it by code ???

thsk
JSB


CREATE TABLE [dbo].[xTable] (
[Test0] [char] (10) COLLATE Latin1_General_ CI_AS NOT NULL ,
[Test1] [char] (10) COLLATE Latin1_General_ CI_AS NULL ,
[Test2] [char] (10) COLLATE Latin1_General_ CI_AS NULL ,
[Test3] [char] (10) COLLATE Latin1_General_ CI_AS NULL ,
[Test4] [char] (10) COLLATE Latin1_General_ CI_AS NULL
) ON [PRIMARY]
GO

ALTER TABLE [dbo].[xTable] ADD
CONSTRAINT [PK_xTable] PRIMARY KEY CLUSTERED
(
[Test0]
) ON [PRIMARY] ,
CONSTRAINT [IX_xTable] UNIQUE NONCLUSTERED
(
[Test0],
[Test1]
) ON [PRIMARY] ,
CONSTRAINT [IX_xTable_1] UNIQUE NONCLUSTERED
(
[Test2],
[Test3],
[Test4]
) ON [PRIMARY]
GO

Aug 10 '05 #2
Sorry Willy, but for the next time read the text carfully ...
instead of saying anything wrong ...

SEE ..... READ FROM HERE
i have a problem with my sql dataadapter, i think.
i have this table below ( Script ) and this table has one particularity,
it has 2 unique constraints.

when i´m filling my datatable using my dataadapter, the datatable only
have one ???

is there any workarround for it, besides do it by code ???
SEE ..... TO HERE


"Willy Denoyette [MVP]" <wi************ *@telenet.be> wrote in message
news:%2******** ********@TK2MSF TNGP09.phx.gbl. .. Please don't cross-post to non SQL related NG, post SQL questions to a SQL
related NG's like this portugese NG microsoft.publi c.pt.sql.

Willy.
"João Santa Bárbara" <jo****@i24port ugal.com> wrote in message
news:uK******** ******@tk2msftn gp13.phx.gbl...
Hi all

i have a problem with my sql dataadapter, i think.
i have this table below ( Script ) and this table has one particularity,
it has 2 unique constraints.

when i´m filling my datatable using my dataadapter, the datatable only
have one ???

is there any workarround for it, besides do it by code ???

thsk
JSB


CREATE TABLE [dbo].[xTable] (
[Test0] [char] (10) COLLATE Latin1_General_ CI_AS NOT NULL ,
[Test1] [char] (10) COLLATE Latin1_General_ CI_AS NULL ,
[Test2] [char] (10) COLLATE Latin1_General_ CI_AS NULL ,
[Test3] [char] (10) COLLATE Latin1_General_ CI_AS NULL ,
[Test4] [char] (10) COLLATE Latin1_General_ CI_AS NULL
) ON [PRIMARY]
GO

ALTER TABLE [dbo].[xTable] ADD
CONSTRAINT [PK_xTable] PRIMARY KEY CLUSTERED
(
[Test0]
) ON [PRIMARY] ,
CONSTRAINT [IX_xTable] UNIQUE NONCLUSTERED
(
[Test0],
[Test1]
) ON [PRIMARY] ,
CONSTRAINT [IX_xTable_1] UNIQUE NONCLUSTERED
(
[Test2],
[Test3],
[Test4]
) ON [PRIMARY]
GO


Aug 11 '05 #3


"João Santa Bárbara" <jo****@i24port ugal.com> wrote in message
news:u5******** ******@TK2MSFTN GP14.phx.gbl...
Sorry Willy, but for the next time read the text carfully ...
instead of saying anything wrong ...

SEE ..... READ FROM HERE
i have a problem with my sql dataadapter, i think.
i have this table below ( Script ) and this table has one particularity,
it has 2 unique constraints.

when i´m filling my datatable using my dataadapter, the datatable only
have one ???

is there any workarround for it, besides do it by code ???

SEE ..... TO HERE

NO I didn't say anything wrong, YOU should take care not to cross-post to
non relevant NG's. Your question is not Csharp nor VB (the languages)
related , it's about "adonet" and "SQL", so if you think you need to
cross-post restrict your posting to these NG's only.

Willy.
Aug 11 '05 #4
João,
| when i´m filling my datatable using my dataadapter, the datatable only
have
| one ???
Which unique constraints does it have?

PK_xTable
IX_xTable
IX_xTable_1

I suspect it only has PK_xTable.
| is there any workarround for it, besides do it by code ???
Did you let the DataAdapter define your DataTable or did you use an XSD or
code?

I suspect you let the DataAdapter

In your XSD or Code are you certain that you defined all constraints
correctly?

My understanding is: Seeing as you have a PrimaryKey, the DataAdapter will
only add the Primary Key constraint & leave the other two unique constraints
off. Based on the three rules at:

http://msdn.microsoft.com/library/de...chematopic.asp

I normally define my datatable schemas in an XSD file & either load that
directly first or have a typed DataSet.

For a complete explanation of Datasets, DataTables, & DataAdapters along
with how to use them. I would strongly recommend you read David Sceppa's
book "Microsoft ADO.NET - Core Reference" from MS Press. As it is both a
good tutorial on ADO.NET as well as a good desk reference once you know
ADO.NET.

Hope this helps
Jay

"João Santa Bárbara" <jo****@i24port ugal.com> wrote in message
news:uK******** ******@tk2msftn gp13.phx.gbl...
| Hi all
|
| i have a problem with my sql dataadapter, i think.
| i have this table below ( Script ) and this table has one particularity,
it
| has 2 unique constraints.
|
| when i´m filling my datatable using my dataadapter, the datatable only
have
| one ???
|
| is there any workarround for it, besides do it by code ???
|
| thsk
| JSB
|
|
|
|
| CREATE TABLE [dbo].[xTable] (
| [Test0] [char] (10) COLLATE Latin1_General_ CI_AS NOT NULL ,
| [Test1] [char] (10) COLLATE Latin1_General_ CI_AS NULL ,
| [Test2] [char] (10) COLLATE Latin1_General_ CI_AS NULL ,
| [Test3] [char] (10) COLLATE Latin1_General_ CI_AS NULL ,
| [Test4] [char] (10) COLLATE Latin1_General_ CI_AS NULL
| ) ON [PRIMARY]
| GO
|
| ALTER TABLE [dbo].[xTable] ADD
| CONSTRAINT [PK_xTable] PRIMARY KEY CLUSTERED
| (
| [Test0]
| ) ON [PRIMARY] ,
| CONSTRAINT [IX_xTable] UNIQUE NONCLUSTERED
| (
| [Test0],
| [Test1]
| ) ON [PRIMARY] ,
| CONSTRAINT [IX_xTable_1] UNIQUE NONCLUSTERED
| (
| [Test2],
| [Test3],
| [Test4]
| ) ON [PRIMARY]
| GO
|
|
|
Aug 11 '05 #5

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

Similar topics

3
11196
by: KULJEET | last post by:
foreign key also refer to unique constraint. (GREAT...) 1.then table that containt unique constraint act as master table????? 2.IS unique constraint will replace with primary key?? 3.Is unique constraint gives all fuctionality as primary key constraint??? thanks kuljeet pal singh
26
45404
by: Agoston Bejo | last post by:
I want to enforce such a constraint on a column that would ensure that the values be all unique, but this wouldn't apply to NULL values. (I.e. there may be more than one NULL value in the column.) How can I achieve this? I suppose I would get the most-hated "table/view is changing, trigger/function may not see it" error if I tried to write a trigger that checks the uniqueness of non-null values upon insert/update.
5
10865
by: Kamil | last post by:
Hello What should I use for better perfomance since unique constraint always use index ? Thanks Kamil
4
38551
by: Dave | last post by:
Can you create a unique constraint on multiple columns, or does it have to be implemented as a unique index? If possible can someone please post some sample code? Thanks,
3
22624
by: Prince Kumar | last post by:
Is there any way I can define an Unique constraint or unique index which allows more than one null values for the same column combination in DB2? ie, If my index is defined on (col3, col4) where both columns allow nulls, I want col3 + col4 to be unique, if one or both the columns have values. If both columns have nulls, it should allow more than one such rows. ex,
10
26092
by: BuddhaBuddy | last post by:
Platform is DB2/NT 7.2.9 The table was created like this: CREATE TABLE MYTEST ( MYTESTOID bigint not null primary key, FK_OTHEROID bigint not null references other, FK_ANOTHEROID bigint not null references another, FK_LASTLYOID bigint not null references lastly, unique (FK_OTHEROID,FK_ANOTHEROID))
5
16713
by: aj | last post by:
DB2 WSE 8.1 FP5 Red Hat AS 2.1 What is the difference between adding a unique constraint like: ALTER TABLE <SCHEMA>.<TABLE> ADD CONSTRAINT CC1131378283225 UNIQUE ( <COL1>) ; and adding a unique index like:
7
6657
by: Brian Keating | last post by:
Hi there, Is it possible to add a unique constraint on two columns in a table, so that the constraint is a composite of the two? i.e. these two columns together should be unique...? i.e. column1 column2 1 1 1 2
10
14670
by: Laurence | last post by:
Hi there, How to differentiate between unique constraint and unique index? These are very similar but I cannot differentiate them? Could someone give me a hand? Thanks in advance
2
15064
by: rorajoey | last post by:
Violation of UNIQUE KEY constraint 'IX_surveyQuestions'. Cannot insert duplicate key in object 'dbo.surveyQuestions'. This might seem like a simple matter of trying to insert a row with ID=20 when there's already one with that ID, but the problem is a bit more complicated. The table is supposed to auto-increment the value for the primary key when a new record is inserted. But no matter what I do, I can't seem to insert more than one record...
0
8262
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 usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8701
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. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8502
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7192
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 launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6122
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 instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4196
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2623
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
1807
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1507
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 effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.