Skip to content

Commit

Permalink
handle boolean to integer cast in sqlserver
Browse files Browse the repository at this point in the history
  • Loading branch information
flarco committed Feb 1, 2025
1 parent f4ca22a commit c69e765
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion core/dbio/database/database_sqlserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -899,7 +899,7 @@ func (conn *MsSQLServerConn) CastColumnForSelect(srcCol iop.Column, tgtCol iop.C
selectStr = g.F("cast(%s as nvarchar(max))", qName)
case srcCol.IsString() && tgtCol.IsInteger():
// assume bool, convert from true/false to 1/0
sql := `case when {col} = 'true' then 1 when {col} = 'false' then 0 else {col} end`
sql := `case when {col} = 'true' then 1 when {col} = 'false' then 0 else cast({col} as bigint) end`
selectStr = g.R(sql, "col", qName)
default:
selectStr = qName
Expand Down

0 comments on commit c69e765

Please sign in to comment.