SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


cannot insert duplicate key row in object 'tablename' with unique index 'indexname'


cannot insert duplicate key row in object 'tablename' with unique index 'indexname'

Author
Message
VRT
VRT
SSC-Addicted
SSC-Addicted (404 reputation)SSC-Addicted (404 reputation)SSC-Addicted (404 reputation)SSC-Addicted (404 reputation)SSC-Addicted (404 reputation)SSC-Addicted (404 reputation)SSC-Addicted (404 reputation)SSC-Addicted (404 reputation)

Group: General Forum Members
Points: 404 Visits: 603
venki (4/28/2009)
Hi,

I want to increase the column size in the table tblCostBuildUp.
I am trying to execute this DDL statement but I am getting the errors.
If I do it from SSMS then it prompts me the foreign key columns and seeking the permission from me. How can we do it from Query Analyzer?

ALTER TABLE [dbo].[tblCostBuildUp] 
ALTER COLUMN [CostWorkOrder] nvarchar(15)



errors:
Msg 5074, Level 16, State 8, Line 1
The object 'aaaaatkOrder'.
Msg 4922, Level 16, State 9, Line 1
ALTER TABLE ALTER COLUMN CostWorkOrder failed because one or more objects access this column.blCostBuildUp4_PK' is dependent on column 'CostWorkOrder'.
Msg 5074, Level 16, State 5, Line 1
The object 'FK_TimeCollection_tblCostBuildUp' is dependent on column 'CostWorkOrder'.
Msg 5074, Level 16, State 5, Line 1
The object 'FK_tblPurchaseOrder_tblCostBuildUp' is dependent on column 'CostWor





Please guide me yar. How to change the column size in query analyzer, not in SSMS?

Thank You
shital_20
shital_20
Forum Newbie
Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)

Group: General Forum Members
Points: 1 Visits: 0
Cannot insert duplicate key row in object 'tablename' with unique index 'indexname' in sql means?
logicinside22
logicinside22
SSC Eights!
SSC Eights! (812 reputation)SSC Eights! (812 reputation)SSC Eights! (812 reputation)SSC Eights! (812 reputation)SSC Eights! (812 reputation)SSC Eights! (812 reputation)SSC Eights! (812 reputation)SSC Eights! (812 reputation)

Group: General Forum Members
Points: 812 Visits: 1403
hope this helps
http://connect.microsoft.com/SQLServer/feedback/details/434632/#details

Aim to inspire rather than to teach.
SQL Server DBA
ChrisM@Work
ChrisM@Work
SSCoach
SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)

Group: General Forum Members
Points: 16298 Visits: 19551
logicinside22 (4/30/2013)
hope this helps
http://connect.microsoft.com/SQLServer/feedback/details/434632/#details


Not really. The connect item refers to a bug which can only be observed if a very specific set of conditions are met.

“Write the query the simplest way. If through testing it becomes clear that the performance is inadequate, consider alternative query forms.” - Gail Shaw

For fast, accurate and documented assistance in answering your questions, please read this article.
Understanding and using APPLY, (I) and (II) Paul White
Hidden RBAR: Triangular Joins / The "Numbers" or "Tally" Table: What it is and how it replaces a loop Jeff Moden
Exploring Recursive CTEs by Example Dwain Camps
wolfkillj
wolfkillj
UDP Broadcaster
UDP Broadcaster (1.5K reputation)UDP Broadcaster (1.5K reputation)UDP Broadcaster (1.5K reputation)UDP Broadcaster (1.5K reputation)UDP Broadcaster (1.5K reputation)UDP Broadcaster (1.5K reputation)UDP Broadcaster (1.5K reputation)UDP Broadcaster (1.5K reputation)

Group: General Forum Members
Points: 1464 Visits: 2582
VRT (4/28/2009)



Please guide me yar. How to change the column size in query analyzer, not in SSMS?


You can't alter a column that is part of the primary key or that is referenced as a foreign key by another table. You have to drop the primary key and foreign key(s) before you can alter the column.

Jason Wolfkill
Blog: SQLSouth
Twitter: @SQLSouth
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search