Rakesh
Rakesh

Reputation: 45

Convert INT to text with new values within SQL View

I have a view which returns 4 columns, Date (filtered by day using datediff), Quantity, Document number.

The field Document Number returns an integer (1-8) but I need it to return for example (1 = Warehouse, 2 = Office, etc etc) Unfortunately, these values don't exist anywhere in the database.

Any help would be appreciated, on how to achieve this and whether this can stay within a view or has to be done via SQL query instead

Upvotes: 0

Views: 96

Answers (1)

John Cappelletti
John Cappelletti

Reputation: 81970

One option is to use CHOOSE()

Example

Select choose(SomeIntValue,'Warehouse','Office', ...)
 From  YourTable

Upvotes: 3

Related Questions