选择查询返回一个bizard错误 [英] select query returning an bizard error

查看:62
本文介绍了选择查询返回一个bizard错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,



i有一个简单的SQL查询当我执行它时会给我一个错误:

查询:选择canceltype,来自canceltype的值,其中companyid = 1且geolocationid = 1且Canceltype = 1



错误:消息245,级别16,状态1,行1

将nvarchar值''Shortage of Vehicle''转换为数据类型int时转换失败。



表结构:



  CREATE   TABLE  [dbo]。[CancelType ](
[id] [ int ] IDENTITY 1 1 NOT NULL
[CancelType] [ nvarchar ]( 50 NULL
[Value] [ int ] NULL
[Companyid] [ int ] NULL
[Geolocationid] [ int ] NULL
[CType] [ int ] NULL
ON [ PRIMARY ]





请帮帮我

解决方案

尝试将列名value更改为TheValue。 SQL可能会将其解释为关键字。我在列表中找不到它,但你永远不知道。您也可以尝试将列名括在[]



中从canceltype中选择[canceltype],[value],其中companyid = 1且geolocationid = 1且Canceltype = 1

hi all,

i have an simple sql query when i excute it is returning me an error:
Query:select canceltype,value from canceltype where companyid=1 and geolocationid= 1 and Canceltype=1

error:Msg 245, Level 16, State 1, Line 1
Conversion failed when converting the nvarchar value ''Shortage of Vehicle'' to data type int.

Table Structure:

CREATE TABLE [dbo].[CancelType](
    [id] [int] IDENTITY(1,1) NOT NULL,
    [CancelType] [nvarchar](50) NULL,
    [Value] [int] NULL,
    [Companyid] [int] NULL,
    [Geolocationid] [int] NULL,
    [CType] [int] NULL
) ON [PRIMARY]



pls help me out

解决方案

Try changing the column name "value" to TheValue. SQL may be interpreting this as a keyword. I could not find it in a list but you never know. You could also try enclosing the column names in []

select [canceltype],[value] from canceltype where companyid=1 and geolocationid= 1 and Canceltype=1


这篇关于选择查询返回一个bizard错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆