Alter table command in SQL Server

M

Madhuri

Hi all

If I want to add a field to an existing table in msaccess while a button on
a form is clicked
how do I execute the equivalent of

alter table xyz add fields(abc text(12))

Thanks
Madhuri
 
R

Ron Weiner

Try

CurrentProject.Connection.Execute "ALTER TABLE xyz ADD COLUMN abc CHAR(12)"

Watch for Newsreader wrap, the above should all be on one line

Ron W
 
R

Ron Weiner

UtOh!!

I just reread the original post. If you want to alter a table on Sql Server
my previous post will not do it. In fact I am not even sure it can be done
from Access. It may be possible to create a pass thru query with the Sql
DDL syntax, but again I have never attempted this.

The code in my previous post will only work when the table you are modifying
is in the same database as the code.

Sorry for any confussion I may have created.

Rom W
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top