473,386 Members | 1,621 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,386 software developers and data experts.

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 1352
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: 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:
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...
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
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,...
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
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...

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.