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 7432673
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T09:29:42+00:00 2026-05-29T09:29:42+00:00

I have a table ‘users’ with ‘login’ column defined as: [login] VARCHAR(50) UNIQUE NOT

  • 0

I have a table ‘users’ with ‘login’ column defined as:

[login] VARCHAR(50) UNIQUE NOT NULL

Now I want to remove this unique constraint/index using SQL script. I found its name UQ_users_7D78A4E7 in my local database but I suppose it has a different name on another database.

What is the best way to drop this unique constraint? Or at least any…

Thanks.

  • 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-29T09:29:43+00:00Added an answer on May 29, 2026 at 9:29 am

    SKINDER, your code does not use column name. Correct script is:

    declare @table_name nvarchar(256)  
    declare @col_name nvarchar(256)  
    declare @Command  nvarchar(1000)  
    
    set @table_name = N'users'
    set @col_name = N'login'
    
    select @Command = 'ALTER TABLE ' + @table_name + ' drop constraint ' + d.name
        from sys.tables t 
        join sys.indexes d on d.object_id = t.object_id  and d.type=2 and d.is_unique=1
        join sys.index_columns ic on d.index_id=ic.index_id and ic.object_id=t.object_id
        join sys.columns c on ic.column_id = c.column_id  and c.object_id=t.object_id
        where t.name = @table_name and c.name=@col_name
    
    print @Command
    
    --execute (@Command)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have table named A with column B defined int not null Primary Key
I have table defined with FlexiGrid. Call to all variables is ok. One column
I have table field defined as like this approved_at DATETIME YEAR TO SECOND NOT
i have table and i tried to add `id` int(11) NOT NULL auto_increment, to
i have table student,fields are student_id, student_name, year_joining ... now i want to rename
I have table with data 1/1 to 1/20 in one column. I want the
I have table with 50 entries (users with such details like Name Surname Location
i have table structure with 3 colums (column1, column2, column3) and i want to
I have table with 3 columns A B C. I want to select *
I have table with a unique auto-incremental primary key. Over time, entries may be

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.