Solved

VB SQL Check if Numeric

Posted on 2014-10-23
1
213 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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Not long ago I saw a question in the VB Script forum that I thought would not take much time. You can read that question (Question ID  (http://www.experts-exchange.com/Programming/Languages/Visual_Basic/VB_Script/Q_28455246.html)28455246) Here (http…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
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…

789 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