![bug.png](http://studygolang.qiniudn.com/170216/c08c0fd37b0fcff614272fa325c856ad.png)
上面出现的错误原因是 我在SQL 语句中添加一个RTRIM() 函数在这个DepositAmount 字段上,然后就会出现这个错误,诡异的是 ,这两条数据是一模一样的,为什么第一条数据是可以读写出来呢,而第二条数据会报错呢,求大神们指点。
//rows, err := db.Query("SELECT JSJID, RTRIM(cast(OrderNumber as CHAR(18))) AS OrderNumber, State, cast(DepositAmount as CHAR(20)) AS DepositAmount, Remark, CreateTime FROM [dbo].[_DepositLog] WHERE DATEDIFF(DAY,CreateTime,GETDATE()) = 6 AND [State] > 90 ORDER BY CreateTime DESC")
rows, err := db.Query("SELECT JSJID, RTRIM(cast(OrderNumber as CHAR(18))) AS OrderNumber, State, RTRIM(cast(DepositAmount as CHAR(20))) AS DepositAmount, Remark, CreateTime FROM [dbo].[_DepositLog] WHERE DATEDIFF(DAY,CreateTime,GETDATE()) = 6 AND [State] > 90 ORDER BY CreateTime DESC")
上面的SQL语句是没有问题的,下面的SQL 执行的结果就会出现上面的如图上面的问题,诡异的是 数据库中的这两条数据是一样的;不知道为什么查询出来的结果是有问题的。
#6