Share via

sql Datatype convert

Sanjay Kumar 21 Reputation points
2021-09-02T17:16:47.013+00:00

I am getting the following error. I know it datatype error,
the thing is here is work early now it failed with this error.

c# code
long cdrid
execute.sp(getcdrdetailsrange @cdrid = cdrid)

SQL CODE
sp getcdrdetailsrange(@cdrid int)
(
select * from cdrdetails where cdrid>@cdrid;
)

ERROR: Error converting data type bigint to int.
TYPE: System.Data.SqlClient.SqlException

why it works so many years and now erroring out

Developer technologies | Transact-SQL
Developer technologies | Transact-SQL

A Microsoft extension to the ANSI SQL language that includes procedural programming, local variables, and various support functions.

SQL Server | Other
SQL Server | Other

Additional SQL Server features and topics not covered by specific categories

0 comments No comments

Answer accepted by question author

Viorel 127K Reputation points
2021-09-02T17:49:38.777+00:00

Probably after the years the values of cdrid became greater than 2,147,483,647. If the column is bigint, then change int to bigint in your getcdrdetailsrange and other SQL scripts. Also make sure that the corresponding C# variables are long.

Was this answer helpful?

0 comments No comments

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.