[英]How to insert long type data in to SQL SERVER Big int type
HI recently im working on a project . HI最近正在从事一个项目。 Its easy for INT but due to overflow situation I want to use bigInt in sql column and i'm sending him a LONG type data like Long l="Somthing value"
and inserting like Insert into Table value(Given Value)
对于INT来说很容易,但是由于溢出的情况,我想在sql列中使用bigInt,并且向他发送LONG类型的数据,例如Long l="Somthing value"
然后像Insert into Table value(Given Value)
一样Insert into Table value(Given Value)
But why there is an error saying "Given value is not matching with the table definition " 但是为什么会出现错误消息“给出的值与表定义不匹配”
Give me a sample code if possible 请给我一个示例代码
插入时指定列名。
into Table(Give_Value_Column) Values(Given Value)
Make sure you are inserting correct values in table. 确保在表中插入正确的值。 Suppose you have three column and you are inserting four values then error will occur. 假设您有三列,并且要插入四个值,则将发生错误。
suppose you have following column ie column1, column2 column3 etc. and you insert statement 假设您有以下一列,即column1,column2,column3等,并且您插入了一条语句
insert into tablename(column1, column2, column3) values ('somevalue','somevalue','somevalue')
Here value is based on datatype that you have mentioned while creating a table. 此处的值基于您在创建表时提到的数据类型。
command = Insert into Table value(Given=@Value)
command.perameter.add(@value, datatype, values)
在插入语句中提及列名,无论您要插入什么列
Since the field in the table is of type bigint, it is not possible to store a long value there. 由于表中的字段为bigint类型,因此无法在其中存储长值。 You could change your application to use an integer for the value, or you can cast the long to an int64 (eq to a bigint in sql) this will drop all the decimal values of the long. 您可以将应用程序更改为使用整数作为值,也可以将long强制转换为int64(在sql中等于bigint),这将删除long的所有十进制值。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.