Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
tvspsekhar
Starting Member
20 Posts |
Posted - 2010-03-18 : 02:38:29
|
| please correct the follwoing syntax.ALTER TABLE TOWERSCH DROP CONSTRAINT PRIMARY KEY(LOCNO);Msg 156, Level 15, State 1, Line 1Incorrect syntax near the keyword 'PRIMARY'.The above error message is coming on execution of the above statement.tvspsekhar |
|
|
raky
Aged Yak Warrior
767 Posts |
Posted - 2010-03-18 : 02:46:58
|
| You statement should be in the following formatALTER TABLE <tablename> DROP CONSTRAINT <constraint Name> |
 |
|
|
haroon2k9
Constraint Violating Yak Guru
328 Posts |
Posted - 2010-03-18 : 02:48:09
|
| ALTER TABLE TOWERSCHDROP CONSTRAINT LOCNO |
 |
|
|
raky
Aged Yak Warrior
767 Posts |
Posted - 2010-03-18 : 02:55:30
|
| first run this queryselect name as 'constraint Name' from sys.objects where type = 'pk'and object_id('TOWERSCH') = parent_object_idthen replace the <constraint name> in below statement ALTER TABLE TOWERSCH DROP CONSTRAINT <constraint Name>with the value returned by firstquery and execute. |
 |
|
|
tvspsekhar
Starting Member
20 Posts |
Posted - 2010-03-18 : 03:16:09
|
quote: Originally posted by raky first run this queryselect name as 'constraint Name' from sys.objects where type = 'pk'and object_id('TOWERSCH') = parent_object_idthen replace the <constraint name> in below statement ALTER TABLE TOWERSCH DROP CONSTRAINT <constraint Name>with the value returned by firstquery and execute.
Now it is working . Thank U Very Muchtvspsekhar |
 |
|
|
raky
Aged Yak Warrior
767 Posts |
Posted - 2010-03-18 : 03:20:08
|
welcome... |
 |
|
|
|
|
|