cancel
Showing results for 
Search instead for 
Did you mean: 

how to create user table keys.

Former Member
0 Kudos

HI,,

I would like to create keys ..in User Tables..

See the image..

in emp master..i create a  field..

my requirement is i Dont want to allow the user post duplicate values..

I Think  100% stored procedure is fulfill my requirement..

but i got info from forum.. it is possible through the keys all  so..

if u say yes..

see the image i am trying to implement it..

but

while pressing the button..

[Microsoft][SQL Server Native Client 10.0][SQL Server]The CREATE UNIQUE INDEX statement terminated because a duplicate key was found for the object name 'dbo.OHEM' and the index name 'OHEMIX_0'. The duplicate key value is  'User Key Description' (OUKD) (<NULL>).

This error is comming..

++++++++++++++++++

Normally what is the my requirement is

if i put in edit box fms..

it has 3 types..

a) Wit&hout Search in User-Defined Values

b)&Search in Existing User-Defined Values

c)Sear&ch in Existing User-Defined Values according to Saved Query

if i choose b option..

it is accepting values

but here it is accepting duplicate values

how can i stop the duplicate values.......

+++++++++++++++++++

any info...

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hello!

And if you try to implement the query above in the Store Procedure SBO_SP_TransactionNotification?

IF @object_type = '171' -- Refers to the Employees Table 

      AND @transaction_type IN ('A') -- This query will be executed when a new employee be added

      BEGIN

      DECLARE @YourUserField varchar(8)

      set @YourUserField = ''

     

Select @YourUserField = isnull(T1.U_YourUserField, '') from OHEM T1 Where T1.[empID] = @num_of_cols_in_key

       

        IF @YourUserField <> ''

              BEGIN

                  Select @error = 1, @error_message='It's not allowed duplicated values for this field!'

              END

            END          

Former Member
0 Kudos

HI,

Thank u very much ..

for your reply..

..

Actually i know about sp..

but

I would  like to know about the keys..

Any way thanks for your reply...

Answers (2)

Answers (2)

KennedyT21
Active Contributor
0 Kudos

Hi $riniva$ Rachumallu..

Use different Keys and field name and try sure it will work , you index the table not the assigning the primary key

better use the TNSP

Hope Helpful

Regards

Kennedy

Former Member
0 Kudos

Hi...

Little bit confusion..

i was able to implement ..

but getting lot of confusion..

in emp master 3 fields are there u_empid, u_test,u_test1

i would like to enter only unique values only..

i took 3  indexes....

first index..

first filed

second inex

second field

third index

third field..

and i checked unique key...

may be it is comparing with respect to the other fields all  so...

See the image..

still allso i is taking duplicate vlaues..

if i take all in one index..

allso accepting duplicate values.....

kothandaraman_nagarajan
Active Contributor
0 Kudos

Hi,

Try to use different key name and then try.

Former Member
0 Kudos

Hi,

It' not accepting any one..

without unique it is taking but

with unique it is not..

what is the use of without unique...