Solved

VB SQL Check if Numeric

Posted on 2014-10-23
1
208 Views
Last Modified: 2014-10-23
Hi Experts

I have a table on SQLServer key of nvarchar(10) and Description
I has Numeric and String in the key
I need to select from another table with a key if INT so I want to check and block any string keys

TableA id nVarchar(10) Key, Description nVarchar(50)
TableB id Int, Amount, Type
 
Select
a.Description
, b. Amount
, b.Type
From TableA a
Left Join
TableB b on (b.id = a.id)

Errors - Error Conversion error when converting the nvarchar value 'The value' to data type int

Thanks
0
Comment
Question by:Kevinfeening
1 Comment
 
LVL 15

Accepted Solution

by:
Haris Djulic earned 500 total points
ID: 40400487
Try like this :

Select 
a.Description
, b. Amount
, b.Type
From TableA a 
Left Join 
TableB b on (b.id = cast( a.id as int))

Open in new window

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

Over the years I have built up my own little library of code snippets that I refer to when programming or writing a script.  Many of these have come from the web or adaptations from snippets I find on the Web.  Periodically I add to them when I come…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

810 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