I am using SQL Server 2008 R2 and hence I can't use the CONCAT function. I want to concatenate three columns which have numbers in them with the datatype nvarchar.
I tried below two methods and they are not working for me:
select top 10
shoppingcartno + lineitemNo + POnumber
from
tbSupplierLineItem
select top 10
CONVERT(varchar(30), ShoppingCartNo) +
CONVERT(varchar(30), lineitemNo) +
CONVERT(varchar(30), POnumber)
from
tbSupplierLineItem
This is the sample data:
ShoppingCartNo LineItemNo DunsNo
--------------------------------------
1000105517 1 009122532
1000427144 2 099441680
1000427144 3 099441680
1000427144 4 099441680
1000491452 3 014296052
1000495759 3 825067460
nvarchar()rather thanvarchar()based on the types of the strings.'something' + null = nullPOnumberis not in your sample data. Is it supposed to beDunsNo?