Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6203115
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T04:51:25+00:00 2026-05-24T04:51:25+00:00

I have a table and I want to drop or set the default value

  • 0

I have a table and I want to drop or set the default value of one of columns. I use below scripts :

ALTER TABLE AccAccountGroup ALTER COLUMN Name DROP DEFAULT

ALTER TABLE AccAccountGroup ALTER COLUMN Name SET DEFAULT 'default value'

when I run the scripts, below errors appears :

Incorrect syntax near the keyword 'DEFAULT'. => for drop script

Incorrect syntax near the keyword 'SET'. => for add script

these scripts are from msdn.

What is the problem? I use SQL Server 2008 R2.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T04:51:26+00:00Added an answer on May 24, 2026 at 4:51 am

    I believe that your reference is for SQL Server Compact Edition. Use this one instead.

    You need to use the CONSTRAINT syntax and you need to use the default’s name. Even though you didn’t assign a name (and I suggest that you do in the future as it’s a good practice), SQL Server will assign one, which you can find using EXEC sp_help AccAccountGroup.

    Try these syntaxes:

    ALTER TABLE AccAccountGroup
    DROP CONSTRAINT <default name>
    
    ALTER TABLE AccAccountGroup
    ADD CONSTRAINT DF_AccAccountGroup_name DEFAULT 'default value' FOR name
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a report that contains a drop down of users. I want the
I want to have a drop down on a form that shows in plain
I have a table that I want : when the table has been updated,
I have a trigger that sets a datetime field in a table row when
I have a Product Model, which contains a foreign key to a ProductCategory record,
I have quite tough task for me to do in T-SQL (MSSQL 2005). I
I am very new to this. And I am trying to configure a net-beans
I've been reading the documentation but I can't find a way to do this.
Not sure how to describe what I'm trying to get from this question, but

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.