这个查询有什么问题 [英] what is wrong in this query

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

问题描述

选择强制转换(B1为int)+(强制转换(H1为int)+(强制转换(C1为int)+(强制转换(I1为int))为[man]来自坎普尔





B1,H1,C1,I1在数据库中声明为nvarchar

解决方案

左括号太多。



 select cast(B1 as int)+ cast(H1 as int)+ cast(C1 as int)+ cast(I1 as int) as [man]来自坎普尔





B1,H1,C1,I1应该在数据库中声明为INT数据类型列。然后你不必使用CAST函数。将数据存储在不代表存储数据类型的列中的数据库是一种非专业的编程实践.INT应存储在INT数据类型中。日期应存储在Date数据中类型。


select cast(B1 as int)+(cast(H1 as int)+(cast(C1 as int)+(cast(I1 as int)) as [man] From Kanpur


B1, H1, C1, I1 is declared as nvarchar in database

解决方案

Too many left parenthesis.

select cast(B1 as int)+cast(H1 as int)+cast(C1 as int)+cast(I1 as int) as [man] From Kanpur 



B1, H1, C1, I1 should be declared in the database as INT data type columns. Then you would not have to use the CAST function. It is an unprofessional programming practice to store data in a database in a column that does not represent the type of data stored. INTs should be stored in INT data type. Dates should be stored in Date data types.


这篇关于这个查询有什么问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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