.NET프로그래밍/SQL Server 2008

19. 제어문 - if문

holland14 2009. 9. 11. 13:45

use tempdb

go

 

declare @num int

set @num = 10

 

-- 조건처리

if @num % 2 = 0

       Select '짝수'

else

       Select '홀수'

go

 

Declare @Data Int

Set @Data = 10

If @Data % 2 <> 0

Begin

       Select '홀수'

       Print '홀수'

End

Else

Begin

       Select '짝수'

       Print '짝수'

End