Need to convert bit to false if true or true if false.

omegalove
omegalove used Ask the Experts™
on
I need to add in the stored proc.

if IsOnlineNow = false then set to  true
else
IsOnlineNow = true then set to false


USE [omegalove]
GO
/****** Object:  StoredProcedure [dbo].[prc_Profile_Update_LastLogin]    Script Date: 10/15/2010 21:42:36 ******/
SET ANSI_NULLS OFF
GO
SET QUOTED_IDENTIFIER ON
GO

ALTER PROCEDURE [dbo].[prc_Profile_Update_LastLogin]
(
      @UserName nvarchar(50),
)
AS
declare @returnCode int
 
select @returnCode = 0
 

      UPDATE tbl_Profile
      SET
      WHERE
       [UserName] = @UserName

if (@@rowcount > 0)
 BEGIN
    GOTO OnExit
 END
select @returnCode = @@ERROR
if (@returnCode <> 0)
BEGIN
   GOTO OnExit
END

OnExit:
    RETURN @returnCode
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
What is the data type of IsOnlineNow?

If numeric and represented by 1/0 for online/offline respectively:

      SET IsOnlineNow = 1 - IsOnlineNow

Otherwise, use a case statement:

      SET IsOnlineNow = CASE WHEN IsOnlineNow = 'true' THEN 'false' ELSE 'true' END
Hi
Use the case statement
Case when IsOnline =0 then 'true'
Else 'false'
as IsOnline

Author

Commented:
k

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial