Conversion failed when converting the nvarchar value 'China Exclusive Products - purchases inc Paper Bags' to data type int.

Umm SQL conversion query...

My Select statement is -

SELECT 
ID,  
Code +  [General-Ledger-Account] 
AS NominalCode 
FROM dbo.[Nominal-Codes] 
Order by Code

Open in new window


ID is an Int
Code is an INT
[General-Ledger-Account]  is nvarchar(100)

Please advise work around..

Thank you
garethtnashAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
Christopher GordonConnect With a Mentor Senior Developer AnalystCommented:
You should CAST the Code field.  Something like this:

SELECT
ID,  
cast(Code as nvarchar(50)) +  [General-Ledger-Account]
AS NominalCode
FROM dbo.[Nominal-Codes]
Order by Code
0
 
garethtnashAuthor Commented:
thank you
0
All Courses

From novice to tech pro — start learning today.