Skip to content

Commit f9190be

Browse files
committed
fix sql
1 parent 8f9f00a commit f9190be

File tree

1 file changed

+2
-10
lines changed

1 file changed

+2
-10
lines changed

mssql/schema.py

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -93,17 +93,9 @@ class DatabaseSchemaEditor(BaseDatabaseSchemaEditor):
9393
sql_rename_table = "EXEC sp_rename %(old_table)s, %(new_table)s"
9494
sql_create_unique_null = "CREATE UNIQUE INDEX %(name)s ON %(table)s(%(columns)s) " \
9595
"WHERE %(columns)s IS NOT NULL"
96-
sql_alter_table_comment = """IF NOT EXISTS (SELECT NULL FROM INFORMATION_SCHEMA.TABLES i
97-
INNER JOIN sys.tables t ON t.name = i.TABLE_NAME
98-
LEFT JOIN sys.extended_properties ep ON t.object_id = ep.major_id
99-
WHERE (ep.name = 'MS_Description' AND ep.minor_id = 0))
100-
EXECUTE sp_addextendedproperty @name = N'MS_Description', @value = %(comment)s,
96+
sql_alter_table_comment = """EXECUTE sp_addextendedproperty @name = N'MS_Description', @value = %(comment)s,
10197
@level0type = N'SCHEMA', @level0name = N'dbo',
102-
@level1type = N'TABLE', @level1name = %(table)s
103-
ELSE
104-
EXECUTE sp_updateextendedproperty @name = N'MS_Description', @value = %(comment)s,
105-
@level0type = N'SCHEMA', @level0name = N'dbo',
106-
@level1type = N'TABLE', @level1name = %(table)s;"""
98+
@level1type = N'TABLE', @level1name = %(table)s"""
10799

108100
sql_alter_column_comment = """EXECUTE sp_addextendedproperty @name = N'MS_Description', @value = %(comment)s,
109101
@level0type = N'SCHEMA', @level0name = N'dbo',

0 commit comments

Comments
 (0)