If @value was not null, How would you express it with a NOT Isnull expression in a case statement?
declare @value1 int
set @value1=1
select *
from table1
where 0 = 0
AND
CASE
WHEN "NOT nullif(@value1,'')"
THEN columnA
END = @value1
When I run the following query. An error is being thrown "Incorrect syntax near 'columnA'"
declare @value1 int
set @value1=2
select *
from table1
where 0 = 0
AND
CASE
WHEN @value1>1 columnA
ELSE 1
END = 1
Hi Andy, the same error was returned. This happens when no value is set as indicated in the expression. Could the error be that some value has to be specified in a set command and not an error with the isNull statement itself?
declare @value1 int
set @value1=
select isNull(@value1, 0)
I am testing a parameter for a Null value.
When I specify a "1" for the value, the expression works correctly:
declare @value1 int
set @value1=1
select nullif(@value1,'')
Without specify a value, I get an error message that reads "Incorrect syntax near the keyword 'select'.":
declare...
Expression (A) Successfully executes, however Expression B returns an error. I want to be able to
conditionaly include a WHERE or AND clause based off of a specified condition. How do I do it?
Expression A
if (2>1)
select *
from table1
where columnA = 2
Expression B
select *
from table1...
I am having a problem when calling a stored procedure. I have designed the stored procedure to accept "Null" values.
Condition 1
Configuation as ColumnA with a value of 1, a query is successfully returned with the expected data set
<cfprocparam cfsqltype="CF_SQL_INTEGER" value="1" type="In"...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.