Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

VB SQL Check if Numeric

Posted on 2014-10-23
1
Medium Priority
?
243 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 2000 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

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
This article is the result of a quest to better understand Task Scheduler 2.0 and all the newer objects available in vbscript in this version over  the limited options we had scripting in Task Scheduler 1.0.  As I started my journey of knowledge I f…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
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…

963 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