April 2, 2014 at 8:06 pm
Comments posted to this topic are about the item TABLESAMPLE output
April 2, 2014 at 11:37 pm
For the given example it returns exactly 5 rows, tablesample option might give different output if the table has more no of rows. :unsure:
April 3, 2014 at 12:01 am
Very interesting question, thanks.
Need an answer? No, you need a question
My blog at https://sqlkover.com.
MCSE Business Intelligence - Microsoft Data Platform MVP
April 3, 2014 at 12:01 am
pmadhavapeddi22 (4/2/2014)
For the given example it returns exactly 5 rows, tablesample option might give different output if the table has more no of rows. :unsure:
Yes indeed, that's the whole point of the question.
Need an answer? No, you need a question
My blog at https://sqlkover.com.
MCSE Business Intelligence - Microsoft Data Platform MVP
April 3, 2014 at 12:02 am
when we are specifying high range of rows nearing to the exact no of rows then it will return all the rows of the table
like , in the QOD
we have total no of rows 5 and tablesample is given for 4 rows, then that particular statement will return 5 rows.
April 3, 2014 at 12:07 am
pmadhavapeddi22 (4/3/2014)
when we are specifying high range of rows nearing to the exact no of rows then it will return all the rows of the tablelike , in the QOD
we have total no of rows 5 and tablesample is given for 4 rows, then that particular statement will return 5 rows.
That's because you probably specify a number of rows that is located on the total amount of pages used for that table.
Need an answer? No, you need a question
My blog at https://sqlkover.com.
MCSE Business Intelligence - Microsoft Data Platform MVP
April 3, 2014 at 12:14 am
My point is, for the given question it returns 5 rows, so answer is 5
April 3, 2014 at 12:17 am
pmadhavapeddi22 (4/3/2014)
My point is, for the given question it returns 5 rows, so answer is 5
Ah ok, I didn't get your point
Execute the query a few times, it will return 0 at some point.
Need an answer? No, you need a question
My blog at https://sqlkover.com.
MCSE Business Intelligence - Microsoft Data Platform MVP
April 3, 2014 at 12:54 am
Thank you for the replies
April 3, 2014 at 1:19 am
Very interesting question, Thanks!
Also one can try restarting sql server (test only) and execute the query it will give you 0 record and later 5 rows.
---------------------------------------------------
"Thare are only 10 types of people in the world:
Those who understand binary, and those who don't."
April 3, 2014 at 3:13 am
This was removed by the editor as SPAM
April 3, 2014 at 5:32 am
I'd never used this option either. Very interesting, so thanks.
April 3, 2014 at 5:37 am
Nice question Anoo. learn something new today. thanks
April 3, 2014 at 6:13 am
Nice question!
But i can't get the purpose of this.
How can an unpredictable option be useful?:-D
April 3, 2014 at 6:54 am
Great question, I'd never heard of TABLESAMPLE, so I looked it up - and then still ended up getting the answer wrong :O
Now I'm just trying to think of when I could use this in my day to day duties...
Be still, and know that I am God - Psalm 46:10
Viewing 15 posts - 1 through 15 (of 31 total)
You must be logged in to reply to this topic. Login to reply
This website stores cookies on your computer.
These cookies are used to improve your website experience and provide more personalized services to you, both on this website and through other media.
To find out more about the cookies we use, see our Privacy Policy