Show enum descript in sql SELECT sentense

Published on Tuesday, February 1, 2011

We have a sql select as the following:

select PointNumber, PointType, PtDescription,Trunk,PtAddress
from dbo.NOWHOSTDB

The result:

You can see PointType column is number type, normally if you have another PointType table which includes Detail Point Type information, you can use INNER JOINT to get point type information string. But how about if you have a ID column in database but you do not related ID detail data table ?

You can give your own point type information when you use Select sentence:

select PointNumber, PointType, **(select 'AI' where PointType = '1') as PointTypeString**, PtDescription,Trunk,PtAddress
from dbo.NOWHOSTDB