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

  • SEARCH
  • Home
  • 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 am trying to drop the default value on a bit column, I have
i have table with filmname and actors column in sql server 2005 i want
I have table with 3 columns A B C. I want to select *
I have table with few rows, after use hover mouse over row I want
I have a table where one of it's columns contains a dropdown list (HtmlSelectItems
I have a table (myTable) with 3 columns [s1, s2, sum] And I want
i have users table and i have posts table i want select from users
I have a table and I want to duplicate specific rows in the table.
I have a table where i want to change cell background on mouse over
I have a large table I want to include in a LaTeX document. It

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.