Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 4864
  • Last Modified:

The data types nvarchar and uniqueidentifier are incompatible in the add operator.

Hi

How do i use a variable of type uniqueidentifier in a string concatentation

Here is my line

SET @filter = @filter + '  J.EngineerID = ''' + @engineerID  + ''''
but i get this error
The data types nvarchar and uniqueidentifier are incompatible in the add operator.

thanks
andrea
0
andieje
Asked:
andieje
  • 2
1 Solution
 
Aneesh RetnakaranDatabase AdministratorCommented:
u need to explicitly convert that unid variable


CAST(unid as varchar)
0
 
Aneesh RetnakaranDatabase AdministratorCommented:
sorry Convert as nVarchar
CAST(unidColumn as nVarchar )
0

Featured Post

Receive 1:1 tech help

Solve your biggest tech problems alongside global tech experts with 1:1 help.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now