Click here to Skip to main content
15,886,071 members
Home / Discussions / Database
   

Database

 
GeneralRe: Get a single record for each user Pin
Afzaal Ahmad Zeeshan25-Mar-15 23:36
professionalAfzaal Ahmad Zeeshan25-Mar-15 23:36 
GeneralRe: Get a single record for each user Pin
Meax25-Mar-15 23:47
Meax25-Mar-15 23:47 
GeneralRe: Get a single record for each user Pin
RUs12326-Mar-15 0:42
RUs12326-Mar-15 0:42 
AnswerRe: Get a single record for each user Pin
Simon_Whale26-Mar-15 1:11
Simon_Whale26-Mar-15 1:11 
AnswerRe: Get a single record for each user Pin
Corporal Agarn26-Mar-15 1:16
professionalCorporal Agarn26-Mar-15 1:16 
AnswerRe: Get a single record for each user Pin
Member 1155935526-Mar-15 20:28
Member 1155935526-Mar-15 20:28 
AnswerRe: Get a single record for each user Pin
Meax3-Apr-15 23:15
Meax3-Apr-15 23:15 
QuestionReason for failing to Drop Column is showing non existent Index Pin
indian14325-Mar-15 8:46
indian14325-Mar-15 8:46 
Hi All,

I have written a small sql script to drop a table and recreate it but it is failing, I tried to drop all existing indexes on the table and column then trying to drop the column, but still fails by saying there is one constraint that's missing, and I don't know why but that constraint doesn't exist in database.
Here is the script that I am writing
DECLARE @ConstraintName nvarchar(200);
DECLARE @TableName nvarchar(500)='ApplicationData';
DECLARE @ColumnName nvarchar(500)='ReportingFpl';

SET NOCOUNT ON
   SET xact_abort ON
   WHILE 0=0 BEGIN      
      SET @constraintName = (
         SELECT TOP 1 constraint_name
            FROM information_schema.constraint_column_usage
            WHERE table_name = @tableName and column_name = @columnName );
      IF @constraintName is null BREAK;
      EXEC ('alter table "'+@tableName+'" drop constraint "'+@constraintName+'"');
	END

ALTER TABLE dbo.ApplicationData DROP COLUMN ReportingFpl;
GO

Error Message
Msg 5074, Level 16, State 1, Line 16
The index 'IX_ApplicationData_ApplicationId-ReportingFpl_PriorityPoints-ContractorPriorityPoints' is dependent on column 'ReportingFpl'.
Msg 4922, Level 16, State 9, Line 16
ALTER TABLE DROP COLUMN ReportingFpl failed because one or more objects access this column.

But the constraint 'IX_ApplicationData_ApplicationId-ReportingFpl_PriorityPoints-ContractorPriorityPoints' doesn't exist in the constraint table at all.

Can anybody please help me in resolving this issue, any link, any suggestion or code snippet helps greatly.

Thanks in advance.
Thanks & Regards,

Abdul Aleem Mohammad
St Louis MO - USA

QuestionSql server 2008 R2 Express Edition working very slow why? Pin
Sandeep Tripathi25-Mar-15 0:44
Sandeep Tripathi25-Mar-15 0:44 
QuestionRe: Sql server 2008 R2 Express Edition working very slow why? Pin
Eddy Vluggen25-Mar-15 1:00
professionalEddy Vluggen25-Mar-15 1:00 
AnswerRe: Sql server 2008 R2 Express Edition working very slow why? Pin
Sandeep Tripathi25-Mar-15 1:10
Sandeep Tripathi25-Mar-15 1:10 
GeneralRe: Sql server 2008 R2 Express Edition working very slow why? Pin
Eddy Vluggen25-Mar-15 1:28
professionalEddy Vluggen25-Mar-15 1:28 
GeneralRe: Sql server 2008 R2 Express Edition working very slow why? Pin
Sandeep Tripathi25-Mar-15 1:31
Sandeep Tripathi25-Mar-15 1:31 
GeneralRe: Sql server 2008 R2 Express Edition working very slow why? Pin
Krishna Murthy G25-Mar-15 1:40
professionalKrishna Murthy G25-Mar-15 1:40 
GeneralRe: Sql server 2008 R2 Express Edition working very slow why? Pin
Sandeep Tripathi25-Mar-15 1:46
Sandeep Tripathi25-Mar-15 1:46 
GeneralRe: Sql server 2008 R2 Express Edition working very slow why? Pin
Eddy Vluggen25-Mar-15 2:04
professionalEddy Vluggen25-Mar-15 2:04 
AnswerRe: Sql server 2008 R2 Express Edition working very slow why? Pin
Tim Carmichael25-Mar-15 2:01
Tim Carmichael25-Mar-15 2:01 
GeneralRe: Sql server 2008 R2 Express Edition working very slow why? Pin
Sandeep Tripathi25-Mar-15 2:16
Sandeep Tripathi25-Mar-15 2:16 
GeneralRe: Sql server 2008 R2 Express Edition working very slow why? Pin
Eddy Vluggen25-Mar-15 3:11
professionalEddy Vluggen25-Mar-15 3:11 
GeneralRe: Sql server 2008 R2 Express Edition working very slow why? Pin
Corporal Agarn25-Mar-15 4:00
professionalCorporal Agarn25-Mar-15 4:00 
AnswerRe: Sql server 2008 R2 Express Edition working very slow why? Pin
Tim Carmichael25-Mar-15 2:33
Tim Carmichael25-Mar-15 2:33 
GeneralRe: Sql server 2008 R2 Express Edition working very slow why? Pin
Sandeep Tripathi25-Mar-15 2:43
Sandeep Tripathi25-Mar-15 2:43 
GeneralRe: Sql server 2008 R2 Express Edition working very slow why? Pin
Tim Carmichael25-Mar-15 2:52
Tim Carmichael25-Mar-15 2:52 
AnswerRe: Sql server 2008 R2 Express Edition working very slow why? Pin
David Mujica25-Mar-15 3:35
David Mujica25-Mar-15 3:35 
AnswerRe: Sql server 2008 R2 Express Edition working very slow why? Pin
jschell25-Mar-15 11:50
jschell25-Mar-15 11:50 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.