Click here to Skip to main content
15,900,378 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi All,
I wrote one Store Procedure for my project.In my querry i have one bit field called "Booking Required ?" and its probable answer is a checkbox i.e YES or NO.
Now this querry is used to create a view but on the view page this field come as "0" for NO and "1" for YES.But i want these field as YES or NO type and not the 0 and 1 type,So how can i use "case" statement in my querry????plz guide me...
My SP is as follows :





CREATE PROCEDURE [dbo].[usp_RW_TASEXIBIITA]

--@int INT
AS
BEGIN

SET NOCOUNT ON

SELECT tbl_TAS_TASRequestMaster.SubmissionDate
,tbl_PM_Project.ProjectName
,tbl_TAS_TASRequestMaster.TRNo
,tbl_PM_Employee.EmployeeName
,tbl_TAS_TASRequestMaster.DateOfTravel
,tbl_TAS_TASRequestMaster.PlaceOfTravel
,tbl_TAS_TASRequestMaster.DateOfTravel
,tbl_TAS_TASRequestMaster.ReturnDate
,tbl_PM_Customer.CustomerName
,tbl_PM_Role.RoleDescription
,tbl_TAS_TASRequestMaster.Purpose
,tbl_TAS_TASRequestMaster.BorneBy
,tbl_TAS_TASRequestMaster.BookingRequired--a bit field

,tbl_TAS_TASRequestMaster.BookingDetails
,tbl_TAS_TASRequestMaster.HotelBookingRequired
,tbl_TAS_TASRequestMaster.HotelDetails
,tbl_TAS_TASRequestMaster.AmountRequested
,tbl_TAS_TASRequestMaster.PayementMode
,tbl_TAS_TASRequestMaster.AdvanceAmountGiven
,tbl_TAS_TASRequestMaster.CommentsByFinanceDept

FROM tbl_TAS_TASRequestMaster WITH(NOLOCK)

INNER JOIN tbl_PM_Project WITH(NOLOCK)
ON tbl_PM_Project.ProjectID = tbl_TAS_TASRequestMaster.ProjectID


INNER JOIN tbl_PM_Employee WITH(NOLOCK)
ON tbl_PM_Employee.EmployeeID=tbl_TAS_TASRequestMaster.EmployeeID


INNER JOIN tbl_PM_Customer WITH(NOLOCK)
ON tbl_PM_Customer.Customer= tbl_TAS_TASRequestMaster.CustomerID


INNER JOIN tbl_PM_Role WITH(NOLOCK)
ON tbl_PM_Role.RoleID=tbl_PM_Employee.PostID


SET NOCOUNT OFF
END
Posted

Try

,tbl_TAS_TASRequestMaster.BorneBy<br />
, case tbl_TAS_TASRequestMaster.BookingRequired WHEN 1 THEN 'YES' ELSE 'NO' END<br />
,tbl_TAS_TASRequestMaster.BookingDetails
 
Share this answer
 
Comments
NeoTheChallenger 4-Jun-10 14:25pm    
thanks dude you told me exactly what i want..
you can also change the bit field as enum

eg: ENUM('Yes','No')
 
Share this answer
 
Comments
Sandeep Mewara 24-Jul-10 10:02am    
Reason for my vote of 1
Why are you digging old questions? Stop that!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900