Tuesday, March 27, 2012

Altering linked tables

I have a table (in Access) that is linked to the SQL server, and I
need to add a column to it. I wrote the following:

ALTER TABLE Census
ADD COLUMN 'ActiveFacility' BIT;

and I get a syntax error that I do not know how to solve. The column
needs to contain yes/no data for each record.

Any help for a struggling newbie?
Thanks,

ChristineChristine (cbrandel@.rehabmanagement.com) writes:
> I have a table (in Access) that is linked to the SQL server, and I
> need to add a column to it. I wrote the following:
> ALTER TABLE Census
> ADD COLUMN 'ActiveFacility' BIT;
> and I get a syntax error that I do not know how to solve. The column
> needs to contain yes/no data for each record.
> Any help for a struggling newbie?

It is always wise to include the error message you get. In this case it
was very easy for me to reproduce the error, but sometimes this is
may be impossible with access to the database.

The best place to find out the syntax for a command, is to look it up
in Books Online, which comes with SQL Server. In the book T-SQL Syntax
Reference you find all T-SQL commands described with syntax diagrams.
Sure, the diagram for ALTER TABLE may seem unwieldy, since you can
alter a table in many ways. On the flip side, there are also examples
for the most common uses of the command.

--
Erland Sommarskog, SQL Server MVP, sommar@.algonet.se

Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techin.../2000/books.aspsql

No comments:

Post a Comment