I didn't test this but if I remember right the syntax goes:
Imports System.Data.OleDb
Dim strSQL As String
Dim oConn As OleDb.OleDbConnection
Dim oCmd As OleDb.OleDbCommand
oConn = New OleDb.OleDbConnection("<connection string>")
strSQL = "ALTER TABLE <table name> ALTER COLUMN FPC_Code CONSTRAINT FPC_Code_PK PRIMARY KEY"
oCmd = New OleDb.OleDbCommand(strSQL, oConn)
oCmd.ExecuteNonQuery()
and this is for the combined table and assuming FPC_Code is still UNIQUE in the combined table. If you want to add PK for each hundred or so tables, dickersonka's answers gives a good starting point.
Reputation Points: 218
Solved Threads: 201
Veteran Poster
Offline 1,024 posts
since Aug 2008