Solved

Convert DataType In View

Posted on 2009-04-15
3
170 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.

Join & Write a Comment

Introduction This article will provide a solution for an error that might occur installing a new SQL 2005 64-bit cluster. This article will assume that you are fully prepared to complete the installation and describes the error as it occurred durin…
INTRODUCTION: While tying your database objects into builds and your enterprise source control system takes a third-party product (like Visual Studio Database Edition or Red-Gate's SQL Source Control), you can achieve some protection using a sing…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

747 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

13 Experts available now in Live!

Get 1:1 Help Now