HiveBrain v1.2.0
Get Started
← Back to all entries
debugsqlMinor

How can I rename an auto-named constraint when I get this error 15248?

Submitted by: @import:stackexchange-dba··
0
Viewed 0 times
thiscanerrorautoconstraintnamed15248gethowwhen

Problem

Method:

Open SSMS. Find table. Open constraints. Find constraint name. Right click, rename. Give new name.

EXPLODE. (well, it just fails, at least)

Solution

You can use sp_rename manually.

Note that this is fixed in SSMS 2012 (I don't remember if I have SP1 installed or not).

EXEC sp_rename
    @objname = N'[myschema].[DF__AccountTy__Allow__7E3AEC52]',
    @newname = N'DF_whatever',
    @objtype = 'OBJECT';

Code Snippets

EXEC sp_rename
    @objname = N'[myschema].[DF__AccountTy__Allow__7E3AEC52]',
    @newname = N'DF_whatever',
    @objtype = 'OBJECT';

Context

StackExchange Database Administrators Q#37147, answer score: 4

Revisions (0)

No revisions yet.