Mssql Error 3728
Contents |
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of
Is Not A Constraint. Could Not Drop Constraint. See Previous Errors.
this site About Us Learn more about Stack Overflow the company Business Learn is not a constraint. could not drop constraint. see previous errors. entity framework more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question is not a constraint drop column x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 6.2 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up
Could Not Enable Or Disable The Constraint. See Previous Errors.
SQL Server Error: “%” is not a constraint. Could not drop constraint. See previous errors up vote 9 down vote favorite 2 I'm using Microsoft SQL Server 2005, and am relatively new to SQL in general. There is a relationship between two tables, "Resources" and "Group_Resources", in the database "Information". Resources has a foreign key, "id", in Group_Resources, named "resource_id". There is a
Not A Constraint Meaning
foreign key constraint, "fk_gr_res_resources", between the two. I'm established as the database owner, and have full read/write/create/delete permissions. I want to delete the foreign key constraint, so I executed the following query: ALTER TABLE [Information].[group_resources] DROP CONSTRAINT fk_gr_res_resources and received the following error: 'fk_gr_res_resources' is not a constraint. Could not drop constraint. See previous errors. I'm confused, because it is a constraint, and there are no spelling errors. Am I going about deleting this improperly? Am I deleting the constraint from the incorrect table? Any suggestions would be greatly appreciated, & please don't flame me: I am new to SQL after all. sql-server share|improve this question edited Aug 16 '10 at 19:42 John Saunders 138k20178323 asked Aug 16 '10 at 19:38 amanda 48114 2 Have you tried to delete the constraint from the other table? That would answer your question about whether you're deleting it from the right place. –SqlRyan Aug 16 '10 at 19:40 Yes- I've tried deleting the constraint from both "gropus_resources" and "resources". I still get the same error. Thanks for the suggestion. –amanda Aug 16 '10 at 19:47 add a co
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company could not drop constraint. see previous errors. primary key Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs
Could Not Drop Object Table Because It Is Referenced By A Foreign Key Constraint
Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 6.2 million programmers, remove primary key sql server just like you, helping each other. Join them; it only takes a minute: Sign up Unable to drop constraint in sql server 2005 “Could not drop constraint. See previous errors” up vote 2 down vote favorite I'm http://stackoverflow.com/questions/3496687/sql-server-error-is-not-a-constraint-could-not-drop-constraint-see-previo trying to drop a constraint on a db table, something like: ALTER TABLE MyTable drop CONSTRAINT FK_MyTable_AnotherTable But the execution just runs and runs. If I stop it I see: Msg 3727, Level 16, State 0, Line 2 Could not drop constraint. See previous errors. Web search throws up various pages but note that the constraint is properly named and I am trying to remove it using the correct name sql sql-server constraints alter-table http://stackoverflow.com/questions/2592977/unable-to-drop-constraint-in-sql-server-2005-could-not-drop-constraint-see-pre share|improve this question asked Apr 7 '10 at 13:53 DannykPowell 68741427 What is the previous error? –marc_s Apr 7 '10 at 14:31 add a comment| 4 Answers 4 active oldest votes up vote 2 down vote accepted Found a way to sort this, although I don't understand why it was necessary. Have been able to drop the constraint by disabling it first: ALTER MyTable NOCHECK CONSTRAINT FK_MyTable_AnotherTable The drop then completes fine Would still welcome any comments on the reason why this is necessary share|improve this answer edited Apr 7 '10 at 16:20 answered Apr 7 '10 at 14:54 DannykPowell 68741427 I want to remove a column that is neither Primary nor Foreign key, I was getting the same error, i tried your solution but it did't work. any ideas ? –Zeeshan Ajmal May 29 '14 at 7:40 add a comment| up vote 1 down vote Verify that you've not already dropped the constraint, like: SELECT OBJECT_ID('FK_MyTable_AnotherTable') If this returns null, your constraint no longer exists. That would explain the error message. share|improve this answer answered Apr 7 '10 at 13:56 Andomar 155k23226274 No the constraint has not already been removed, I have tried your method as well as others and it definitely still exists. It will also stop me dropping the associated column –DannykPowel
resources Windows Server 2012 resources Programs MSDN subscriptions Overview Benefits Administrators Students Microsoft Imagine Microsoft Student Partners ISV Startups TechRewards Events Community Magazine Forums Blogs https://msdn.microsoft.com/en-us/library/bb210210(v=office.12).aspx Channel 9 Documentation APIs and reference Dev centers Samples Retired content We’re http://blog.sqlauthority.com/2009/05/12/sql-server-how-to-drop-primary-key-contraint/ sorry. The content you requested has been removed. You’ll be auto redirected in 1 second. MSDN Library MSDN Library MSDN Library MSDN Library Design Tools Development Tools and Languages Mobile and Embedded Development .NET Development Office development Online Services Open Specifications patterns & practices Servers could not and Enterprise Development Speech Technologies Web Development Windows Desktop App Development TOC Collapse the table of content Expand the table of content This documentation is archived and is not being maintained. This documentation is archived and is not being maintained. Invalid SQL Syntax: expected token: AS (Error 3728) This error occurs when defining or creating a could not drop view or procedure through SQL DDL. The error would be generated with the following syntax: CREATE VIEW viewname SELECT…. To avoid the error, change the syntax to the following: CREATE VIEW viewname AS SELECT…. Community Additions Show: Inherited Protected Print Export (0) Print Export (0) Share IN THIS ARTICLE Is this page helpful? Yes No Additional feedback? 1500 characters remaining Submit Skip this Thank you! We appreciate your feedback. Dev centers Windows Office Visual Studio Microsoft Azure More... Learning resources Microsoft Virtual Academy Channel 9 MSDN Magazine Community Forums Blogs Codeplex Support Self support Programs BizSpark (for startups) Microsoft Imagine (for students) United States (English) Newsletter Privacy & cookies Terms of use Trademarks © 2016 Microsoft © 2016 Microsoft
SERVER - How to Drop Primary Key Contraint May 12, 2009Pinal DaveSQL, SQL Server, SQL Tips and Tricks54 commentsOne area that always, unfailingly pulls my interest is SQL Server Errors and their solution. I enjoy the challenging task of passing through the maze of error to find a way out with a perfect solution. However, when I received the following error from one of my regular readers, I was a little stumped at first! After some online probing, I figured out that it was actually syntax from MySql and not SQL Server. The reader encountered error when he ran the following query.ALTER TABLE Table1
DROP PRIMARY KEY
GO Msg 156, Level 15, State 1, Line 3 Incorrect syntax near the keyword ‘PRIMARY'.As mentioned earlier, this syntax is for MySql, not SQL Server. If you want to drop primary key constraint in SQL Server, run the following query. ALTER TABLE Table1
DROP CONSTRAINT PK_Table1_Col1
GO Let us now pursue the complete example. First, we will create a table that has primary key. Next, we will drop the primary key successfully using the correct syntax of SQL Server.CREATE TABLE Table1(
Col1 INT NOT NULL,
Col2 VARCHAR(100)
CONSTRAINT PK_Table1_Col1 PRIMARY KEY CLUSTERED (
Col1 ASC)
)
GO