Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SQL Server 2012 Syntax Error

Status
Not open for further replies.

pat718

Programmer
Apr 21, 2014
12
US
I am trying to alter a table to add a column and than update that column with integer values from 0 to 5. I keep getting a syntax error near my WHERE clause. Here's is what I wrote:

alter table aggregator_table
add access_level integer
WHERE access_level == 0 and access_level<=5

Can anyone help me? Thanks.
 
First of all, you can't add a column and update in the alter statement. You need to add the column (using the alter table statement) and then do an update. Second, == isn't Microsoft SQL Server syntax.

-SQLBill

The following is part of my signature block and is only intended to be informational.
Posting advice: FAQ481-4875
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top