Try
lcInsertStr = "ALTER TABLE " + lcTableName + " ADD CONSTRAINT Table_PK PRIMARY KEY (Studnt_Id_)"
HTH
>I am trying to put a primary key into a table. Later I will be trying to set up relationships between the tables. For now I just want the primary keys in the tables. I have a hard time reading the help file on Alter Table.
>I am using SPT from VFP 6 SP5. And the data is checked at the main database before my program even trys to put it into SQL Server 2000.
>lcTableName = the name of the table in the database
>studnt_id_ is a actual field in the table.
>
>Here is the code that I am doing now:
>
> lcInsertStr = [ALTER TABLE ] + lcTableName + [ ALTER COLUMN studnt_id_ PRIMARY KEY]
>
>
>The error I get is incorrect syntax near 'PRIMARY'.