Click here to Skip to main content
15,911,531 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
if count(issue) in project is 0
return 1
else if(count(issue)>0 and count(issue)<5)
return 0
else
return -1

I want to create function for above in sql...
Please tel me how to do
Posted
Comments
Chris Reynolds (UK) 15-Feb-13 5:25am    
I answered this under your other question

1 solution

You can try this function

SQL
create function Check_Issue()
 returns  int
   As
     begin
      Declare @count int
      Declare @result int
        select @count = count(issue) from project   --take value in one variable
           if (@count = 0 )                          -- check in if loop
            Begin
              set  @result = 1
            End
            else if (@Count > 0 and @count < 5)
              set  @result = 0
            else
              set  @result = -1
       return @result                               -- return value
   End
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900