January 24, 2017 at 9:34 am
I have a function where i have to check column not null
if @sen like 'BY%' and @fdd NOT NULL
begin
select bla bla
end
else if @fdd NOT NULL
begin
select bla bla
end
Is the above check and format is correct?
January 24, 2017 at 12:40 pm
You must use "IS NOT NULL" rather than just "NOT NULL":
if @sen like 'BY%' and @fdd IS NOT NULL
...
SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".
January 24, 2017 at 1:59 pm
And @fdd is a variable, not a column. If you want to check that a column is not null, you'll need to put it in a WHERE (or possibly HAVING) clause of a SELECT/UPDATE/DELETE/INSERT statement.
J. Drew Allen
Business Intelligence Analyst
Philadelphia, PA
January 25, 2017 at 2:00 am
mcfarlandparkway - Tuesday, January 24, 2017 9:34 AMI have a function where i have to check column not null
if @sen like 'BY%' and @fdd NOT NULL
begin
select bla blaend
else if @fdd NOT NULL
begin
select bla bla
end
Is the above check and format is correct?
Have you considered using an inline table-valued function rather than a multistatement table-valued function or scalar function?
For fast, accurate and documented assistance in answering your questions, please read this article.
Understanding and using APPLY, (I) and (II) Paul White
Hidden RBAR: Triangular Joins / The "Numbers" or "Tally" Table: What it is and how it replaces a loop Jeff Moden
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply