Ads were blocked - no problem. But keep in mind that developing HeidiSQL, user support and hosting takes time and money. You may want to send a donation instead.

MSSQL: updating and dropping extended properties (column comments)

igitur's profile image igitur posted 4 years ago in General Permalink
To change a column comment in MSSQL, use sp_updateextendedproperty

When the user tries to change the column comment to an empty string, use sp_dropextendedproperty instead of trying to set the comment to a blank string.
ansgar's profile image ansgar posted 4 years ago Permalink
Let me say, managing column and table comments in MSSQL is a mess.

But yes...
igitur's profile image igitur posted 3 years ago Permalink

This is still a problem.

I'm just trying to change a column from nullable to nullable. I'm not touching the comments. There aren't even comments.

But then this:

ALTER TABLE "dbo"."Bond"
    ALTER COLUMN  "Apply28FebEndOfMonthException" BIT NOT NULL;
EXECUTE sp_addextendedproperty 'MS_Description', '', 'Schema', 'dbo', 'table', 'Bond', 'column', 'Apply28FebEndOfMonthException';
/* SQL Error (15233): Property cannot be added. Property 'MS_Description' already exists for 'dbo.Bond.Apply28FebEndOfMonthException'. */
Ads were blocked - no problem. But keep in mind that developing HeidiSQL, user support and hosting takes time and money. You may want to send a donation instead.
igitur's profile image igitur posted 3 years ago Permalink

Solution: Don't add the extended property if the trimmed string is an empty string.

igitur's profile image igitur posted 3 years ago Permalink

Also happens when ADDING a column. If the comment is empty, don't set the extended property.

ALTER TABLE "dbo"."YieldCurve" ADD "IncludeInAutomatedGeneration" BIT NULL;
EXECUTE sp_addextendedproperty 'MS_Description', '', 'Schema', 'dbo', 'table', 'YieldCurve', 'column', 'IncludeInAutomatedGeneration';

Please login to leave a reply, or register at first.