Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Primary Key generation
Message
 
À
25/04/2013 03:55:13
Naeem Afzal
Syed Junaid Alam
Manama, Bahrain
Information générale
Forum:
Visual FoxPro
Catégorie:
Client/serveur
Divers
Thread ID:
01571831
Message ID:
01571880
Vues:
53
In SQL Server, all you do is define a column as an integer (normally) ans specify that it is an identity column.

That's all there is.

Every time you insert a record into the table, the identity column with be incremented to a unique value. Normally you do not insert a value into an identity column - it populates automatically.

>Thanks for your reply. I am using the following method to generate primary key
>
>Begin Transaction
> SELECT PKTable
> RLOCK()
> Replace PK_Type_Field with PK_Type_Field + 1
> lnNewPK = PK_Type_Field
>
> * insert/update/etc
> * first Master table with lnNewPk
> * then Child table with lnNewPK
>
> * Now Rollback / Commit
>
> SELECT PKTable
> UNLOCK
>END TRANSACTION
>
>
>if I use the identity column as my primary key then how can I generate my Alternate Key as the above. What is the T-SQL for above code?
>
>TIA
____________________________________

Don't Tread on Me

Overthrow the federal government NOW!
____________________________________
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform