Reputation: 1242
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
Upvotes: 0
Views: 969
Reputation: 1026
Try altering the query like below
select top 10
CONVERT(varchar(30),isnull(ShoppingCartNo,''))
+CONVERT(varchar(30),isnull(lineitemNo,''))
+CONVERT(varchar(30),isnull(POnumber,''))
from tbSupplierLineItem
Upvotes: 1