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 |
|
johnny1walker
Starting Member
17 Posts |
Posted - 2012-03-15 : 19:36:11
|
| Hi everybody..i got a problemfirsti add a constraint PK1Use testGOALTER TABLE tablo1 ADD CONSTRAINT PK1 PRIMARY KEY (a1)GOhow do IChange the name of the constraint as PK1 PK2 Table1 a1 area |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
|
|
johnny1walker
Starting Member
17 Posts |
Posted - 2012-03-15 : 20:51:13
|
| how can I?andI tried these codes:USE testGOEXEC sp_rename N'tablo1.PK1', N'PK2', N'a1';GObut gives an error messageMsg 15249, Level 11, State 1, Procedure sp_rename, Line 75Error: Explicit @objtype 'a1' is unrecognized. |
 |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2012-03-15 : 21:06:37
|
please refer to the BOOKS ON LINE on the value of @objtypehttp://msdn.microsoft.com/en-us/library/ms188351%28v=sql.90%29.aspx KH[spoiler]Time is always against us[/spoiler] |
 |
|
|
johnny1walker
Starting Member
17 Posts |
Posted - 2012-03-15 : 21:21:13
|
| thanks.but.i just started to sqlI do not know how to.I only want to do ichange PK1 to PK2 |
 |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2012-03-15 : 21:29:10
|
quote: Originally posted by johnny1walker thanks.but.i just started to sqlI do not know how to.I only want to do ichange PK1 to PK2
Did you take a look at the link ? It tells you what are the value that you should pass into the @objtype parameterIt is ok if you are new to SQL. But when you not sure how to use a function or stored procedure on syntax or anything, refer to the Books OnLine. I am trying not to provide you the answer directly but pointing you to resources, help files where you can find the answer yourself. KH[spoiler]Time is always against us[/spoiler] |
 |
|
|
johnny1walker
Starting Member
17 Posts |
Posted - 2012-03-15 : 22:45:51
|
i find script Use testGOsp_rename 'PK1', 'PK2', 'OBJECT'GO |
 |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2012-03-15 : 22:49:44
|
Good  KH[spoiler]Time is always against us[/spoiler] |
 |
|
|
|
|
|
|
|