From: Eric Isaacs on
RETURN has to be used from within a Stored Procedure or a User Defined
Function. If you just want the SQL to provide the value to you
without a RETURN without a function or stored procedure, just use
SELECT (or PRINT.)

IF @accTimeRun > @sqlTimeRun
SELECT 1 AS ReturnValue;
ELSE
SELECT 0 AS ReturnValue;


IF @accTimeRun > @sqlTimeRun
PRINT 1
ELSE
PRINT 0

Also, if you don't care about the 0 or 1, you could just RETURN/SELECT/
PRINT @accTimeRun > @sqlTimeRun and get a Boolean value back.

SELECT @accTimeRun > @sqlTimeRun AS ReturnValue


-Eric Isaacs
From: Plamen Ratchev on
"Eric Isaacs" <eisaacs(a)gmail.com> wrote in message
news:47cbe221-01c9-4805-ac23-b9e707a52684(a)w7g2000hsa.googlegroups.com...
>
> Also, if you don't care about the 0 or 1, you could just RETURN/SELECT/
> PRINT @accTimeRun > @sqlTimeRun and get a Boolean value back.
>
> SELECT @accTimeRun > @sqlTimeRun AS ReturnValue
>

This will not work in the current versions of SQL Server. The SQL standard
supports boolean data type but it is not implemented in SQL Server.

Plamen Ratchev
http://www.SQLStudio.com

From: Eric Isaacs on
>> SELECT @accTimeRun > @sqlTimeRun AS ReturnValue


> This will not work in the current versions of SQL Server. The SQL standard
> supports boolean data type but it is not implemented in SQL Server.

I don't know what I was thinking. Thanks!

-Eric Isaacs