As developers, we often work with SQL Server stored procedures. The SQL Server stored procedures can have many purposes.
One of them is to perform some logical operations and to return true or false value. The problem is that there is no boolean datatype so the only way is that stored procedure returns bit datatype.
Here is an example of stored procedure that will return bit value that could be used instead of boolean:
- Advertisement -
- Advertisement -
USE [Database]
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[spReturnValue]
AS
DECLARE @result BIT
SET @result = 1
RETURN (@result)
GO
In order to call the stored procedure use the following SQL code:
USE [Database]
GO
DECLARE @return_value BIT
EXEC @return_value = [dbo].[spReturnValue]
SELECT 'Return Value' = @return_value
GO
- Advertisement -