Fix LastInsertId is not supported

This commit is contained in:
Aleksandar Dimtirov 2020-07-30 13:27:49 +02:00 committed by Gerhard Gruber
parent 7e26dfea98
commit cf2c573358

View File

@ -176,8 +176,17 @@ func (mssql) SelectFromDummyTable() string {
return ""
}
func (mssql) LastInsertIDReturningSuffix(tableName, columnName string) string {
func (mssql) LastInsertIDOutputInterstitial(tableName, columnName string, columns []string) string {
if len(columns) == 0 {
// No OUTPUT to query
return ""
}
return fmt.Sprintf("OUTPUT Inserted.%v", columnName)
}
func (mssql) LastInsertIDReturningSuffix(tableName, columnName string) string {
// https://stackoverflow.com/questions/5228780/how-to-get-last-inserted-id
return "; SELECT SCOPE_IDENTITY()"
}
func (mssql) DefaultValueStr() string {