|
From: Eric Isaacs on 22 Jul 2008 21:42 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 22 Jul 2008 22:05 "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 22 Jul 2008 22:27 >> 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
First
|
Prev
|
Pages: 1 2 Prev: CTE and DDL Next: Using single character wildcards in stored procedure and allow |