Solved

Convert DataType In View

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

Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
SQL Server Degrading on Write 13 72
CROSS APPLY 4 61
SQL Server: SNAPSHOT replication to include a newly added table. 2 34
Using this function 4 40
by Mark Wills PIVOT is a great facility and solves many an EAV (Entity - Attribute - Value) type transformation where we need the information held as data within a column to become columns in their own right. Now, in some cases that is relatively…
In this article we will get to know that how can we recover deleted data if it happens accidently. We really can recover deleted rows if we know the time when data is deleted by using the transaction log.
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

749 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