Composite Keys

Composite Keys

Post by Dinesh Hospet » Fri, 20 Feb 1998 04:00:00



Is it possible to implement a Btrieve database with a composite key
consisting of 3 data elements? I am interested in developing with
Btrieve 6.15 and would like any suggestions.

Thanks in Advance

 
 
 

Composite Keys

Post by Danie Dio » Fri, 20 Feb 1998 04:00:00


Yes you can.

You have just to define keys with multi-segment

Ex:    No            6    string------segment  2-----
          Name     15   String                                 |
          Date         4   integer-----segment 0-------->key0 (Date_Time_no)
          Filler        10  string                                  |
          time          4   integer------segment 1-----

 
 
 

1. Key construction with composite Keys

I am building a database that is making use of composite keys.  To insert
data, and in the process creating keys, I am using stored procs with code
like the following pseudo-code:

select

from
    SomeTable
where
    <blah criteria>


begin



    begin

        select

        from
            SomeTable
        where
            <blah criteria>


data>)


            break


    end

I added this loop so that in the rare case that another transaction updated
the table after the 2nd select and before the 3rd, the stored proc would
automatically retry to create a key and insert the data.  Do I even need
this loop?  Will SqlServer's locking mechanism protect me from returning the
same 'max(Table.KeyPart) + 1)' twice?  I know it will if I set the
transaction type to Serialized, but, as I understand it, that would impact
perf considerablebly.  I'd like to keep the Transaction type as Read
Committed (default?).

Also, should I put that first select statement in the loop?

Thanks,
Wells

2. No Opened Cursor

3. Compound Key vs Composite Key

4. Optional New Service for your Pager!

5. Performance comparision of retrieving records using composite key or single key

6. 17822-FL-Orlando-SQL-ORACLE-Windows 95-UNIX-Visual Basic-PowerBuilder-Analyst/Programmer

7. Regarding previous post about finding primary key/composite keys

8. SC-Greenville-113553--RDB-DBA Skills-ORACLE-Performance Tuning-DB2-PERFMODL-Oracle DBA

9. Determining primary key (or composite keys) of a table through JDBC

10. Row based keys or composite key

11. Surrogate Keys As Part Of Composite Keys?

12. Howto? Anti-join on a composite key

13. Outer joins with composite keys.