Chapter 3 DBMS Reference Guide


UseSpPrimKey

Use the Sp_primarykey statement to generate a primary key.

For a database that supports the procedure to implement key definition, you can test the value of the corresponding variable %USE_SP_PKEY% and choose between the creation key in the table or launching a procedure.

Value Result
Yes The Sp_primarykey statement is used to generate a primary key
No Primary keys are generated separately in an alter table statement

Example

In Microsoft SQL Server:

UseSpPrimKey = YES
Add entry of Pkey contains

[%USE_SP_PKEY%?[execute] sp_primarykey %TABLE%, %PKEYCOLUMNS%
:alter table [%QUALIFIER%]%TABLE%
   add [constraint %CONSTNAME%] primary key [%IsClustered%] (%PKEYCOLUMNS%)
      [%OPTIONS%]]

 


Copyright (C) 2005. Sybase Inc. All rights reserved.