Drop Down MenusCSS Drop Down MenuPure CSS Dropdown Menu

Thursday 17 May 2018

How to cast bigint to nvarchar 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 nvarchar(50)

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


Error:
Error converting data type nvarchar to bigint.

Solutions:
You need to typecast the bigint to varchar.

set @EmployeeTransIDGUID = N'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...