Skip to content

Commit

Permalink
MSSQL: system object names change to lower case
Browse files Browse the repository at this point in the history
  • Loading branch information
shaohua-deng authored Sep 5, 2019
1 parent 76ca740 commit d726b60
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions dialect_mssql.go
Original file line number Diff line number Diff line change
Expand Up @@ -435,15 +435,15 @@ func (db *mssql) GetTables() ([]*core.Table, error) {
func (db *mssql) GetIndexes(tableName string) (map[string]*core.Index, error) {
args := []interface{}{tableName}
s := `SELECT
IXS.NAME AS [INDEX_NAME],
C.NAME AS [COLUMN_NAME],
IXS.is_unique AS [IS_UNIQUE]
FROM SYS.INDEXES IXS
INNER JOIN SYS.INDEX_COLUMNS IXCS
ON IXS.OBJECT_ID=IXCS.OBJECT_ID AND IXS.INDEX_ID = IXCS.INDEX_ID
INNER JOIN SYS.COLUMNS C ON IXS.OBJECT_ID=C.OBJECT_ID
AND IXCS.COLUMN_ID=C.COLUMN_ID
WHERE IXS.TYPE_DESC='NONCLUSTERED' and OBJECT_NAME(IXS.OBJECT_ID) =?
IXS.name AS [INDEX_NAME],
C.name AS [COLUMN_NAME],
IXS.is_unique AS [IS_UNIQUE]
FROM sys.indexes IXS
INNER JOIN sys.index_columns IXCS
ON IXS.object_id=IXCS.object_id AND IXS.index_id = IXCS.index_id
INNER JOIN sys.columns C
ON IXS.object_id=C.object_id AND IXCS.column_id=C.column_id
WHERE IXS.type_desc='NONCLUSTERED' and OBJECT_NAME(IXS.OBJECT_ID) =?
`
db.LogSQL(s, args)

Expand Down

0 comments on commit d726b60

Please sign in to comment.