Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Help Needed.......

Author  Topic 

ashishashish
Constraint Violating Yak Guru

408 Posts

Posted - 2009-04-01 : 07:19:35
We have a table which contains Unique Record .. every time new person join
the system we have to insert 1 New record

Structure of table follows...

CREATE TABLE [dbo].[Tbl_Customer_Tree](
[Stack_Top] [int] NULL,

[CUSTID] [decimal](18, 0) NOT NULL,

[LFt] [int] NULL,

[RGT] [int] NULL,

[Intro_Id] [decimal](18, 0) NULL,

CONSTRAINT [PK_Tbl_Customer_Tree] PRIMARY KEY CLUSTERED

(

[CUSTID] ASC

)WITH (IGNORE_DUP_KEY = OFF) ON [PRIMARY],

CONSTRAINT [IX_Tbl_Customer_Tree_1] UNIQUE NONCLUSTERED

(

[LFt] ASC

)WITH (IGNORE_DUP_KEY = OFF) ON [PRIMARY]

) ON [PRIMARY]


if we remove unique index from LFT it will work really fast but in this
case we cannot guarantee the non-duplicacy of records in tbl_Customer_tree
which in turn can very abruptly effect our system

Right now approx 6,00,000/- Records in the table.... we tried to remove
the unique index from lft and tried to create unique constraint but unique
constraint act as unique index ...

if you can help us in any manner it will be great help
*********************

DonAtWork
Master Smack Fu Yak Hacker

2167 Posts

Posted - 2009-04-01 : 09:11:21
umm. You have a PRIMARY KEY. That is a unique constraint. What is the problem?

From Books Online: A table can have only one PRIMARY KEY constraint, and a column that participates in the PRIMARY KEY constraint cannot accept null values. Because PRIMARY KEY constraints guarantee unique data, they are frequently defined on an identity column.

[Signature]For fast help, follow this link:
http://weblogs.sqlteam.com/brettk/archive/2005/05/25.aspx
Learn SQL or How to sell Used Cars
For ultra basic questions, follow these links.
http://www.sql-tutorial.net/
http://www.firstsql.com/tutor.htm
http://www.w3schools.com/sql/default.asp
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2009-04-01 : 12:46:01
what does LFt value denote?
Go to Top of Page

ashishashish
Constraint Violating Yak Guru

408 Posts

Posted - 2009-04-02 : 00:24:35
Its A Tree Type of Structure so Evry Time Any Customer Join Thr group then the value of the Customers Above this,,is incremented by 1 so lft stores only numbers,,,
This is a Tree structure......
like...



...
May be this can solve any issue...
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2009-04-03 : 12:39:08
whats the purpose of unique index on lft?
Go to Top of Page
   

- Advertisement -