Drop Down MenusCSS Drop Down MenuPure CSS Dropdown Menu

Friday, 11 May 2018

How to cast bigint to varchar in SQL Server? - Solved


Hi developers, I am writing this blog for helping one of my internet friend who asked for my help.



I am sharing the query on which the error is occurring for future reference.

Example:

declare @EmployeeTransID bigint
set @EmployeeTransID=33234000234454
declare @EmployeeTransIDGUID varchar(50)

select @EmployeeTransID as EmployeeTransID
set @EmployeeTransIDGUID = 'IMGHUNT' + @EmployeeTransID
select @EmployeeTransID as EmployeeTransID, @EmployeeTransIDGUID as EmployeeTransIDGUID

Error:
Error converting data type varchar to bigint.

Solutions:
You need to typecast the bigint to varchar.

set @EmployeeTransIDGUID = 'IMGHUNT' + CAST(@EmployeeTransID as varchar(50))


Hope you find the article helpful & interesting.


For any query, comment us below.



Click imagination hunt to read latest blogs.


Keep learning and sharing...

No comments:

Post a comment

Featured post

Think that makes you rich and richer

 Napolean said: “You can think and grow rich, but if you can be brought up like most people with work and you won't starve, this wil...