View Question with Variables

Last Post 22 Aug 2011 11:17 AM by gunneyk. 2 Replies.
AddThis - Bookmarking and Sharing Button Printer Friendly
  •  
  •  
  •  
  •  
  •  
Sort:
PrevPrev NextNext
You are not authorized to post a reply.
Author Messages Not Resolved
H654381
New Member
New Member

--
22 Aug 2011 08:01 AM

I need to create a view that queries a table that contains a column with record data of 1, 2, 3, 4.  I'd like the view to update the values to be as follows 1 = A, 2 = D, 3 = L and so on.  I cannot change the data in the table I'm making the query, but I need a translation in the view it's going.  So, when I query, I get an A where a 1 was, a D where a 2 was.  Remember, I cannot update the table it's coming from.

rm
New Member
New Member

--
22 Aug 2011 08:38 AM
Tried with case statement?
gunneyk
New Member
New Member

--
22 Aug 2011 11:17 AM
Yes rm has the correct method for this.

SELECT CASE Column WHEN 1 THEN 'A' WHEN 2 THEN 'B' ... END AS [Your Name]
FROM YourTable
You are not authorized to post a reply.

Acceptable Use Policy