Last active
February 12, 2016 05:14
-
-
Save schwartzmx/a46d4b3ba26a0fe0ffa3 to your computer and use it in GitHub Desktop.
T-SQL Magic8Ball
This file contains 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
create procedure [prc_Magic8Ball] | |
( | |
@question varchar(100) | |
) | |
-- Author: Phil | |
-- Example: exec prc_Magic8Ball 'Will I make it into the office on time today?'; | |
as | |
begin | |
set nocount on; | |
declare @phrase as table (name varchar(50)); | |
declare @chosen varchar(50); | |
insert into @phrase (name) | |
values | |
('It is certain') | |
,('It is decidedly so') | |
,('Without a doubt') | |
,('Yes, definitely') | |
,('You may rely on it') | |
,('As I see it, yes') | |
,('Most likely') | |
,('Outlook good') | |
,('Yes') | |
,('Signs point to yes') | |
,('Reply hazy try again') | |
,('Ask again later') | |
,('Better not tell you now') | |
,('Cannot predict now') | |
,('Concentrate and ask again') | |
,('Don''t count on it') | |
,('My reply is no') | |
,('My sources say no') | |
,('Outlook not so good') | |
,('Very doubtful') | |
select top 1 @chosen = name from @phrase order by newid() | |
print @question | |
print '> '+@chosen | |
end | |
go |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment