Solved

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

Posted on 2011-09-02
2
340 Views
Last Modified: 2012-05-12
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
0
Comment
Question by:garethtnash
2 Comments
 
LVL 14

Accepted Solution

by:
Christopher Gordon earned 500 total points
ID: 36473205
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
 

Author Closing Comment

by:garethtnash
ID: 36473245
thank you
0

Featured Post

Best Practices: Disaster Recovery Testing

Besides backup, any IT division should have a disaster recovery plan. You will find a few tips below relating to the development of such a plan and to what issues one should pay special attention in the course of backup planning.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Why is this different from all of the other step by step guides?  Because I make a living as a DBA and not as a writer and I lived through this experience. Defining the name: When I talk to people they say different names on this subject stuff l…
For both online and offline retail, the cross-channel business is the most recent pattern in the B2C trade space.
Using examples as well as descriptions, and references to Books Online, show the documentation available for date manipulation functions and by using a select few of these functions, show how date based data can be manipulated with these functions.
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.

911 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

24 Experts available now in Live!

Get 1:1 Help Now