Last active
December 19, 2015 09:59
-
-
Save othtim/5936805 to your computer and use it in GitHub Desktop.
fizzbuzz tsql
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| IF OBJECT_ID ( 'dbo.fb', 'P' ) IS NOT NULL | |
| drop procedure dbo.fb; | |
| GO | |
| CREATE PROCEDURE dbo.fb (@int int) | |
| AS | |
| set @int = @int + 1 | |
| select @int, | |
| case | |
| when (@int % 3 = 0) then 'fizz' --'fizz' | |
| when (@int % 5 = 0) then 'buzz' --'buzz' | |
| else cast(@int as char) | |
| end | |
| execute dbo.fb @int | |
| GO | |
| execute dbo.fb 1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment