SQL Server datatypes nvarchar and varchar are incompatible error
You should use the +
for string concatenation:
SELECT
ResolverID AS ddlValue,
ResolverTeam + ' | ' + ResolverPerson AS ddlText
FROM dbo.TblResolvers
Order By ResolverTeam, ResolverPerson;
Why am I getting this error?
You were getting that error, because of the &
operator, which is the Bitwise AND.
Is this a concatenation attempt? ResolverTeam & ' | ' & ResolverPerson
&
is the bitwise operator AND
, replace it with +
and see what happens.
Try replacing the &
for a +
; by the looks of it, what you're trying to do is to concatenate 2 columns. Something you do need to be careful about is that nvarchar
is double the size of regular varchar
, which means there are chars in nvarchar
that are not in the varchar
table.
To concatenate strings in MSSQL you should use +
SELECT ResolverID AS ddlValue,
ResolverTeam + ' | ' + ResolverPerson AS ddlText
FROM dbo.TblResolvers Order By ResolverTeam, ResolverPerson;