ma access query to assign pk

  • Thread starter Thread starter Bernie Yaeger
  • Start date Start date
B

Bernie Yaeger

Is there a way in MS Access to assign a PK to a table through a query. I am
creating the table with 'select .... into <tablename> from etc' which works
fine, once executed with executenonquery. But I need to give it a pk as
well - how can this be done?

Thanks for any help.

Bernie Yaeger
 
Bernie:

I'm not sure about access adn don't want to lead you down the wrong road,
but you can defintiely fire an Alter Table command with SqlClient and
executenonquery. basically you'd just build your Alter Table or other DDL
statement and set it as the command object's commandtext..then just fire
ExecuteNonQuery. The same may hold for Access and OleDb Client. I know you
can't do some things like Create DataBase w/ Access but I thinik you can run
Alter Table. I don't have access here or I'd try it myself, but it's worth
a try if you have a few minutes since it wouldn't take much to test.

Cheers,

Bill
 
Hi Bill,

I got it now - I do approach it as you describe, but I needed the syntax
that MS Access would accept - but I got it now. Thanks for your help, as
always

Bernie
 
Back
Top