473,467 Members | 1,967 Online
Bytes | Software Development & Data Engineering Community
Create 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 1355
Please don't cross-post to non SQL related NG, post SQL questions to a SQL
related NG's like this portugese NG microsoft.public.pt.sql.

Willy.
"Joćo Santa Bįrbara" <jo****@i24portugal.com> wrote in message
news:uK**************@tk2msftngp13.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****************@TK2MSFTNGP09.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.public.pt.sql.

Willy.
"Joćo Santa Bįrbara" <jo****@i24portugal.com> wrote in message
news:uK**************@tk2msftngp13.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****@i24portugal.com> wrote in message
news:u5**************@TK2MSFTNGP14.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****@i24portugal.com> wrote in message
news:uK**************@tk2msftngp13.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
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...
26
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.)...
5
by: Kamil | last post by:
Hello What should I use for better perfomance since unique constraint always use index ? Thanks Kamil
4
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
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...
10
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...
5
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...
7
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....
10
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
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...
0
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...
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,...
0
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...
1
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...
0
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...
0
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,...
1
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...
0
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...
0
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 ...

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.