简体   繁体   English

如何将长类型数据插入到SQL SERVER Big int类型

[英]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.

相关问题 如果未键入int类型数据,SQL插入命令将显示错误 - SQL insert command shows error if int type data is not typed 方法上的长数据类型接受一个int - long data type on method accepts an int 如何在SQL Server中使用SqlReader将对象类型转换为Int - How to convert object type to Int with SqlReader in SQL server 如何使用c#将DateTime类型的数据插入SQL Server数据库? - How insert the data with DateTime type into SQL Server database using c#? 如何使用 c# (latebound) 将来自 SQL Server 的货币数据类型插入到 crm 中的货币字段 - How to insert money data type from SQL server into currency field in crm using c# (latebound) 如何在SQL Server中使用“日期”数据类型 - How to use the 'date' data type in SQL Server 如何在sql server的日期时间类型列中插入空值 - How to insert null in datetime type column in sql server 如果选中复选框,如何在SQL Server中为位类型字段插入1或0? - How to insert 1 or 0 in Sql Server for bit type field if checkbox is checked? 如何将可为空的INT类型传递给INSERT INTO参数 - How to pass in nullable INT type to INSERT INTO parameter 如何使用这种“组合”数据类型:(int, int)[] - How to use this "combined" data type: (int, int)[]
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM