Solved

Convert DataType In View

Posted on 2009-04-15
3
189 Views
Last Modified: 2012-05-06
Is there a way to convert a VIEW's DataType that is outputs?

Example:

SELECT CountryID(Integer), Description FROM Country

So the above select statement would be the view. BUT..........I need to convert for this views purposes the CountryID from INT to Varchar(6)

Weird I know, dealing with a crazy ERP system.
0
Comment
Question by:chrisryhal
  • 2
3 Comments
 
LVL 60

Expert Comment

by:chapmandew
ID: 24149935
sure:

select cast(countryid as int) as CountryID, description from country
0
 
LVL 60

Accepted Solution

by:
chapmandew earned 500 total points
ID: 24149947
there may be some you can't convert...you'll get errors.  in whichc case, try this:

select cast(countryid as int) as CountryID, description from country
where isnumeric(countryid) > 0
0
 
LVL 2

Author Comment

by:chrisryhal
ID: 24149979
AWESOME, thanks
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Data architecture is an important aspect in Software as a Service (SaaS) delivery model. This article is a study on the database of a single-tenant application that could be extended to support multiple tenants. The application is web-based develope…
In this article I will describe the Backup & Restore method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
In a recent question (https://www.experts-exchange.com/questions/28997919/Pagination-in-Adobe-Acrobat.html) here at Experts Exchange, a member asked how to add page numbers to a PDF file using Adobe Acrobat XI Pro. This short video Micro Tutorial sh…

823 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