Author |
Topic |
JBelthoff
Posting Yak Master
173 Posts |
Posted - 2008-08-18 : 12:11:15
|
OK It's Monday. I love this forum! Read it all the time. I am going on vacation tomorrow and was hoping to get some silly examples of useless queries just for fun.Here is my contributionselect 'as' as [as] order by newid() JBelthoff• Hosts Station is a Professional Asp Hosting Provider› As far as myself... I do this for fun! |
|
spirit1
Cybernetic Yak Master
11752 Posts |
Posted - 2008-08-18 : 12:16:39
|
moved here since it's a topic for the corral _______________________________________________Causing trouble since 1980Blog: http://weblogs.sqlteam.com/mladenpSpeed up SSMS development: www.ssmstoolspack.com <- version 1.0 out! |
 |
|
Transact Charlie
Master Smack Fu Yak Hacker
3451 Posts |
Posted - 2008-08-19 : 07:38:57
|
[code]CREATE TABLE #Words( key_col int NOT NULL IDENTITY PRIMARY KEY, word varchar(15) NOT NULL)SET NOCOUNT ONINSERT INTO #Words VALUES( 0x6966 )INSERT INTO #Words VALUES( 0x796f75 )INSERT INTO #Words VALUES( 0x63616E )INSERT INTO #Words VALUES( 0x72656164 )INSERT INTO #Words VALUES( 0x74686973 )INSERT INTO #Words VALUES( 0x776974686F7574 )INSERT INTO #Words VALUES( 0x657865637574696E67 )INSERT INTO #Words VALUES( 0x7468656E )INSERT INTO #Words VALUES( 0x796F75 )INSERT INTO #Words VALUES( 0x617265 )INSERT INTO #Words VALUES( 0x61 )INSERT INTO #Words VALUES( 0x74727565 )INSERT INTO #Words VALUES( 0x6765656B )SELECT CASE WHEN key_col IN(2,3,max_key-1,max_key-2) THEN REPLICATE('/',4) ELSE SPACE(4) END + CASE WHEN key_col IN(max_key/2,max_key/2+1) THEN REPLICATE('/', 8) ELSE SPACE(8) END + SPACE(SQRT(SQUARE(radius)-SQUARE(ABS(radius-key_col+1)))) + CAST(word AS VARCHAR(15)) + REPLICATE('~', max_len - LEN(word))FROM #Words CROSS JOIN (SELECT (1. * COUNT(*) - 1) / 2 AS radius, MAX(LEN(word)) AS max_len, MAX(key_col) AS max_key FROM #Words) AS RORDER BY key_colDROP TABLE #Words[/code]-------------Charlie |
 |
|
jezemine
Master Smack Fu Yak Hacker
2886 Posts |
Posted - 2008-08-19 : 09:47:22
|
quines are neat. this is not mine:set quoted_identifier offdeclare @a varchar(147)declare @b varchar(37)declare @sq chardeclare @dq chardeclare @qm charset @a='set quoted_identifier offdeclare @a varchar(147)declare @b varchar(37)declare @sq chardeclare @dq chardeclare @qm charset @a='set @sq="'"set @dq='"'set @qm='?'set @b='print replace(@a,@qm,@sq)+@a+@sq+@b'print @a+@sq+@a+@sqprint 'set @sq='+@dq+@sq+@dqprint 'set @dq='+@sq+@dq+@sqprint 'set @qm='+@sq+@qm+@sqprint 'set @b='+@sq+@b+@sqset @a='print @a+@sq+@a+@sqprint ?set @sq=?+@dq+@sq+@dqprint ?set @dq=?+@sq+@dq+@sqprint ?set @qm=?+@sq+@qm+@sqprint ?set @b=?+@sq+@b+@sqset @a=?'print replace(@a,@qm,@sq)+@a+@sq+@b from: http://www.trollied.org/~blimey/quines.php elsasoft.org |
 |
|
mfemenel
Professor Frink
1421 Posts |
Posted - 2008-08-19 : 15:04:02
|
while this query does have a purpose, I do consider it silly. I actually just found it in production.select * from(select btskey,sectorid,sectorkeytablenamechangedhere) as reftablewhere reftable.btskey=16027 and reftable.sectorid=1Mike"oh, that monkey is going to pay" |
 |
|
tkizer
Almighty SQL Goddess
38200 Posts |
|
Van
Constraint Violating Yak Guru
462 Posts |
Posted - 2008-08-19 : 17:24:28
|
Not a silly query but just an tidbit of usefull information. It's a bad idea to name your user created stored procedures to begin with "sp_". |
 |
|
TG
Master Smack Fu Yak Hacker
6065 Posts |
Posted - 2008-08-19 : 17:33:40
|
quote: Originally posted by Van Not a silly query but just an tidbit of usefull information. It's a bad idea to name your user created stored procedures to begin with "sp_".
great info, thanks!Just don't post it on your blog then post several topics and responses under various usernames promoting your blog Be One with the OptimizerTG |
 |
|
tkizer
Almighty SQL Goddess
38200 Posts |
|
spirit1
Cybernetic Yak Master
11752 Posts |
Posted - 2008-08-19 : 17:43:12
|
well then she's not for blogging... someone will surely hurt your feeling at one time._______________________________________________Causing trouble since 1980Blog: http://weblogs.sqlteam.com/mladenpSpeed up SSMS development: www.ssmstoolspack.com <- version 1.0 out! |
 |
|
Van
Constraint Violating Yak Guru
462 Posts |
Posted - 2008-08-19 : 18:00:40
|
It's also faster, better, easier and more straightforward to have a bit column for every nullable column in your database and have it set to 0 if the column isn't populated and just populate the nullable field to 0 or '' if it's null. That way you don't have to use the "IS NULL" syntax. Much much better way to do it than actually populateing with a NULL. For other usefull tips check out:http://it.toolbox.com/people/sqlusa |
 |
|
webfred
Master Smack Fu Yak Hacker
8781 Posts |
Posted - 2008-08-19 : 18:06:01
|
that is silly - but it's not a query.Planning replaces chance by mistake |
 |
|
TG
Master Smack Fu Yak Hacker
6065 Posts |
Posted - 2008-08-19 : 18:19:50
|
quote: Originally posted by tkizer She deleted her blog. It was quite amusing, but I suspect we hurt her feelings. Tara KizerMicrosoft MVP for Windows Server System - SQL Serverhttp://weblogs.sqlteam.com/tarad/Subscribe to my blog
yep - I suspect you're right about that. Too bad, I never thought there was anything wrong with posting accurate information even if it's well known - just unfortunate she got busted (and slightly flamed) promoting it under a different username Be One with the OptimizerTG |
 |
|
DavidChel
Constraint Violating Yak Guru
474 Posts |
Posted - 2008-08-20 : 09:03:24
|
quote: Originally posted by Van Not a silly query but just an tidbit of usefull information. It's a bad idea to name your user created stored procedures to begin with "sp_".
::golf claps:: |
 |
|
|