I probably found a bug because you define return type of count function as integer but I'm getting always a string value. Of course I could have something wrong in MSSQL adapter or dialect but I didn't find any function which return count value. Any hint?