Got a query that when I try and run it it returns Conversion failed when converting the nvarchar value ‘0003/’ to data type int.
Query is
SELECT
name,
date,
CAST(('0' + Location + '/' + ID) AS nvarchar(50)) AS [UniqNumber]
FROM
Table
Upon this it returns Conversion failed when converting the nvarchar value ‘0003/’ to data type int. Location and ID are both ints.
You need to cast the inputs.
inthas higher data type precedence than the string datatypes. If you dostring + intit will try and cast the string to an integer and add it rather than casting the integer to a string and concatenating it.