Skip to content

Commit 2f7e8fc

Browse files
committed
Fix syntax error when getting field comments in migration with special DB name
Refs: dd0e76a, gorm/sqlserver#151
1 parent 0a5395f commit 2f7e8fc

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

migrator.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -279,7 +279,7 @@ func (m Migrator) GetColumnComment(stmt *gorm.Statement, fieldDBName string) (co
279279
if m.DB.DryRun {
280280
queryTx.DryRun = false
281281
}
282-
queryTx.Raw("SELECT value FROM ?.sys.fn_listextendedproperty('MS_Description', 'SCHEMA', ?, 'TABLE', ?, 'COLUMN', ?)",
282+
queryTx.Raw("SELECT value FROM [?].sys.fn_listextendedproperty('MS_Description', 'SCHEMA', ?, 'TABLE', ?, 'COLUMN', ?)",
283283
gorm.Expr(m.CurrentDatabase()), m.getTableSchemaName(stmt.Schema), stmt.Table, fieldDBName).Scan(&comment)
284284
return
285285
}

0 commit comments

Comments
 (0)