   execSql(test, "select cast(null as ntext) as text", null)
 
 exports.image = (test) ->
-  execSql(test, "select cast(0x1234 as image)", [0x12, 0x34])
+  execSql(test, "select cast(0x1234 as image)", new Buffer [0x12, 0x34])
 
 exports.imageNull = (test) ->
   execSql(test, "select cast(null as image)", null)


  execSql(test, "#{dropTable} #{dropSchema} #{createSchema} #{createTable} #{insert} #{select}", xml)

execSql = (test, sql, expectedValue) ->
  test.expect(2)


exports.smallDatetimeNull = (test) ->
  execSql(test, "select cast(null as smalldatetime)", null)

if tdsVersion >= '7_3_A'
  exports.datetime2 = (test) ->
    execSql(test, "select cast('2011-12-4 10:04:23' as datetime2)", new Date('December 4, 2011 10:04:23 +00'))

  exports.datetime2Null = (test) ->
    execSql(test, "select cast(null as datetime2)", null)

  exports.time = (test) ->
    execSql(test, "select cast('10:04:23' as time)", new Date(Date.UTC(1970, 0, 1, 10, 4, 23)))

  exports.timeNull = (test) ->
    execSql(test, "select cast(null as time)", null)

  exports.date = (test) ->
    execSql(test, "select cast('2014-03-08' as date)", new Date(Date.UTC(2014, 2, 8)))

  exports.dateNull = (test) ->
    execSql(test, "select cast(null as date)", null)

  exports.dateTimeOffset = (test) ->
    execSql(test, "select cast('2014-02-14 22:59:59.9999999 +05:00' as datetimeoffset)", new Date(Date.UTC(2014, 1, 14, 17, 59, 59, 999)))

exports.dateTimeOffsetNull = (test) ->
  execSql(test, "select cast(null as datetimeoffset)", null)

exports.numericSmallValue = (test) ->
  execSql(test, "select cast(9.3 as numeric(3,2))", 9.3)

