July 10, 2012 at 4:44 am
rhythmk (7/9/2012)
I got the answer in first click but then I thought what if SQL 2012 get WHERE clause in TRUNCATE command :hehe:
I pondered that, and tried to think of a way it could be written to only deallocate* selected pages, and couldn't figure out a quick way it could have been implemented.
Then I wondered if it could have been changed to ignore the erroneous clause... but decided that would create an even larger hue and of course cry. "No No..." I told myself, "the current behaviour is perfect. They couldn't possibly have changed it."
---====####====----
* "Deallocate"... or is there a more proper term for what TRUNCATE does?
July 10, 2012 at 4:52 am
Very easy question.
Thanks
Vinay Kumar
-----------------------------------------------------------------
Keep Learning - Keep Growing !!!
July 10, 2012 at 5:37 am
Thanks for the question Samith. I'm guessing you specified an SQL Server version to avoid problems that occasionally pop up with QotD's that don't specify the version. In this case, it actually made the question less straightforward. But, you likely gathered that from the earlier posts. In summary,
+57.
[font="Verdana"]Please don't go. The drones need you. They look up to you.[/font]
Connect to me on LinkedIn
July 10, 2012 at 7:04 am
Thomas Abraham (7/10/2012)
Thanks for the question Samith. I'm guessing you specified an SQL Server version to avoid problems that occasionally pop up with QotD's that don't specify the version. In this case, it actually made the question less straightforward. But, you likely gathered that from the earlier posts. In summary,+57.
+57 + 1
For a moment I had my doubts and thought "maybe it did change? Surely the QotD wouldn't be this easy. There has to be a catch." But, I went with what I knew and it was right. Thank you for the great question. QotD always gets my day started right. 😀
July 10, 2012 at 7:23 am
I'm not sure if it was a trick question or an easy question, but I followed my instincts on the way TRUNCATE works and got it right.
It's a good way to start the day.
July 10, 2012 at 7:39 am
Thomas Abraham (7/10/2012)
Thanks for the question Samith. I'm guessing you specified an SQL Server version to avoid problems that occasionally pop up with QotD's that don't specify the version. In this case, it actually made the question less straightforward. But, you likely gathered that from the earlier posts. In summary,+57.
To me the question was clear, but specifying the version made me wonder if there had been a change in 2012 with regard to TRUNCATE. So, I ended up doing a little research, just to be sure, before answering.
July 10, 2012 at 8:01 am
It did make me think seriously about getting a 2012 instance installed in a development/learning mode.
July 10, 2012 at 8:12 am
Thanks for the straight forward question which only has ONE correct answer. 😛
Cheers,
Steve
July 10, 2012 at 8:29 am
Thank you for the easy question, it also made me think and test about WHERE added to TRUNCATE in SS 2012, but after testing I wondered, would there be a reason to add a WHERE clause to TRUNCATE? Isn't TRUNCATE a quick and easy way to remove all records in a table without condition?
"El" Jerry.
July 10, 2012 at 8:44 am
Nice straight forward easy question. Not certain why adding the server version would cause the answer to be any less clear. Second sentance in BOL for Truncate is;
TRUNCATE TABLE is similar to the DELETE statement with no WHERE clause
July 10, 2012 at 8:58 am
good question - cheers
July 10, 2012 at 10:06 am
EZ PZ
Jason...AKA CirqueDeSQLeil
_______________________________________________
I have given a name to my pain...MCM SQL Server, MVP
SQL RNNR
Posting Performance Based Questions - Gail Shaw[/url]
Learn Extended Events
July 10, 2012 at 10:08 am
SanDroid (7/10/2012)
Not certain why adding the server version would cause the answer to be any less clear.
Because many of us prefer to answer based on current knowledge/guesswork, and then research it afterwards 🙂
July 10, 2012 at 10:26 am
Thanks for a really easy point! 😀
July 10, 2012 at 10:42 am
I nearly bit at the implication that SQL 2012 added syntax to allow truncating a table that met certain conditions. Had to find BOL 2012 online to disuade myself of that notion.
Viewing 15 posts - 16 through 30 (of 39 total)
You must be logged in to reply to this topic. Login to reply