简体   繁体   中英

How to insert long type data in to SQL SERVER Big int type

HI recently im working on a project . 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)

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

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. 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM