Click here to Skip to main content
13,200,202 members (64,347 online)
Rate this:
 
Please Sign up or sign in to 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 14-Feb-13 23:12pm
Comments
Chris Reynolds (UK) 15-Feb-13 5:25am
   
I answered this under your other question

1 solution

Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 2

You can try this function

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
  Permalink  
v2

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

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy |
Web01 | 2.8.171020.1 | Last Updated 15 Feb 2013
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100