Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 224
  • Last Modified:

Convert DataType In View

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
chrisryhal
Asked:
chrisryhal
  • 2
1 Solution
 
chapmandewCommented:
sure:

select cast(countryid as int) as CountryID, description from country
0
 
chapmandewCommented:
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
 
chrisryhalAuthor Commented:
AWESOME, thanks
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now