Solved

VB SQL Check if Numeric

Posted on 2014-10-23
1
198 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
Comment Utility
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

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

Suggested Solutions

Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
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…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

772 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

10 Experts available now in Live!

Get 1:1 Help Now