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
341 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

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Question has a verified solution.

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

Suggested Solutions

Occasionally there is a need to clean table columns, especially if you have inherited legacy data. There are obviously many ways to accomplish that, including elaborate UPDATE queries with anywhere from one to numerous REPLACE functions (even within…
Ever needed a SQL 2008 Database replicated/mirrored/log shipped on another server but you can't take the downtime inflicted by initial snapshot or disconnect while T-logs are restored or mirror applied? You can use SQL Server Initialize from Backup…
This videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function
Viewers will learn how to use the UPDATE and DELETE statements to change or remove existing data from their tables. Make a table: Update a specific column given a specific row using the UPDATE statement: Remove a set of values using the DELETE s…

803 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