Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Convert DataType In View

Posted on 2009-04-15
3
Medium Priority
?
220 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 2000 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

Get your Conversational Ransomware Defense e‑book

This e-book gives you an insight into the ransomware threat and reviews the fundamentals of top-notch ransomware preparedness and recovery. To help you protect yourself and your organization. The initial infection may be inevitable, so the best protection is to be fully prepared.

Question has a verified solution.

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

If you having speed problem in loading SQL Server Management Studio, try to uncheck these options in your internet browser (IE -> Internet Options / Advanced / Security):    . Check for publisher's certificate revocation    . Check for server ce…
In this article I will describe the Copy Database Wizard 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.
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …

596 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