Temporary Table Limitations

  • Koen Verbeeck (4/6/2016)


    Boooo, temp tables can be partitioned.

    So I guess BOL should be corrected?

    Temporary Tables

    You can create local and global temporary tables. Local temporary tables are visible only in the current session, and global temporary tables are visible to all sessions. Temporary tables cannot be partitioned.

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • Ed Wagner (4/6/2016)


    morlindk (4/6/2016)


    I have not tried it out. However,

    http://jasonbrimhall.info/2014/05/23/can-you-partition-a-temporary-table/

    ...states that partitioning is possible!?

    Hence the answer.

    How do you mean that: the answer is "A temp table created in a trigger must have a different name than another temp table created in the session", but the answer should (also) be "Temporary tables cannot be partitioned", since this in not a limitation.

  • I didn't realize temporary tables could be partitioned, so there's an issue with BOL. However I've also reversed the question to remove the double negative, looking for two limitations.

    Points awarded back.

  • Steve Jones - SSC Editor (4/6/2016)


    I didn't realize temporary tables could be partitioned, so there's an issue with BOL. However I've also reversed the question to remove the double negative, looking for two limitations.

    Points awarded back.

    99% correct answers now.

  • TomThomson (4/6/2016)


    It was however easy to see which of them was the one that was wanted, just by looking at the wording - it was the only one not expressed as a negative; all the commenters complaining about "double negative" should have noticed that the one answer said "must have a different name than" (:sick: what a barbarous Americanism :laugh:)instead of "cannot have the same name as", avoiding the double negative, so was clearly the odd one out - ie the required answer.

    You aren't honestly saying you didn't understand the phrase "must have a different name than" with a straight face, are you? A man of your considerable experience must have encountered far worse than this.

  • Ed Wagner (4/6/2016)


    TomThomson (4/6/2016)


    It was however easy to see which of them was the one that was wanted, just by looking at the wording - it was the only one not expressed as a negative; all the commenters complaining about "double negative" should have noticed that the one answer said "must have a different name than" (:sick: what a barbarous Americanism :laugh:)instead of "cannot have the same name as", avoiding the double negative, so was clearly the odd one out - ie the required answer.

    You aren't honestly saying you didn't understand the phrase "must have a different name than" with a straight face, are you? A man of your considerable experience must have encountered far worse than this.

    Why doesn't SQLServerCentral have <joke> <ekoj> tags? I'm not sure whether you picked up my intent and I'm also not sure whether I picked up yours.

    But let's reply as if I took the question seriously.

    Of course I'm not saying that. Just saying that the American English language has "different than" in many cases where British English has "different from" and this is one of the cases where the American usage sounds particularly horrible to many British people.

    (this is where I need those tags again)

    So now let's have a go at bad-mouthing all American and British speakers of English.

    This use of "than" instead of "from" is a nice example of the strangeness of American English speakers. Another nice example is their belief that publication is more important than decision (which is why July 2 1776 is forgotten while July 4 1776 is not).

    But it has to be recognised that British English speakers too are pretty strange: they amply demonstrated their own strangeness in the events affecting America that took place between April 4 1764 (although perhaps Main Bladen had already done that pretty thoroughly about 33 years earlier) and October 1774 (when Tom Gage proved himself as much of a fool as had Main Bladen). They demonstrated it in Scotland in that period too, when the British English speakers first ran a policy of genocide and then a policy of ethic cleansing against the Scottish Gael - something similar to their earlier treatment of the Irish Gael.

    Burn's "parcel o' rogues" were of course British English speakers, whose only redeeming quality (which of course Burns didn't mention) was that they would never even dream of saying "than" where they should say "from".

    And of course another poet didn't think much of "some of the tribe around here with their grotty coats and big hats on their heads, tight trews split all the way down and hidden socks - that tribe is awful" (my translation, rough and ready - I'd have been wasting my time giving you the Gaelic text, wouldn't I) who were the American English speakers in eastern North Carolina. They were pretty anti-Gael too (so that it's quite amazing that one of America's folk-heroes had a Gaelic surname); their ancestors had brought that racism across the Atlantic and they'd brought it down from Virginia with them, and they made it clear that they had that attitude when they took over eastern North Carolina, which was a mainly gaelic-speaking area. Their only redeeming features (again unmentioned by the poet) were their dispute with the British English speakers and that they didn't completely eradicate the gaelic language from N Carolina until some time after 1927 (if I remember the history correctly, that's when the last church in N Carolina conducting regular services in gaelic abandoned them in favour of having only English services) which is a lot later than in the rest of the USA (of course that may just be a sign of incompetence rather than a redeeming feature).

    Well, this screed has one redeeming feature: it has nothing to do with SQL Server, so it fits well here. So this is clearly the wrong place for it, as it's not one of those forums - :hehe: could that be a second redeeming feature?

    Tom

  • TomThomson (4/6/2016)


    Ed Wagner (4/6/2016)


    TomThomson (4/6/2016)


    It was however easy to see which of them was the one that was wanted, just by looking at the wording - it was the only one not expressed as a negative; all the commenters complaining about "double negative" should have noticed that the one answer said "must have a different name than" (:sick: what a barbarous Americanism :laugh:)instead of "cannot have the same name as", avoiding the double negative, so was clearly the odd one out - ie the required answer.

    You aren't honestly saying you didn't understand the phrase "must have a different name than" with a straight face, are you? A man of your considerable experience must have encountered far worse than this.

    Why doesn't SQLServerCentral have <joke> <ekoj> tags? I'm not sure whether you picked up my intent and I'm also not sure whether I picked up yours.

    Fair enough - thank you. I didn't think it was possible and I may have been poking you a bit. 😉 I won't get into the difference between "different than" versus "different from" but do have one serious question for you:

    What is an <ekoj> tag? The <joke> is simple enough, but I've not heard of <ekoj> before. My guess would be e-Joke or backwards joke, but I would also guess that I'm wrong.

  • Luis Cazares (4/6/2016)


    Koen Verbeeck (4/6/2016)


    Boooo, temp tables can be partitioned.

    So I guess BOL should be corrected?

    Temporary Tables

    You can create local and global temporary tables. Local temporary tables are visible only in the current session, and global temporary tables are visible to all sessions. Temporary tables cannot be partitioned.

    Absolutely yes - BOL is wrong.

    I demonstrate that in the blog article that has been pasted a few times.

    I can't believe it has already been two years since that article. Looks like I need to fix the code tags since I changed my code plugin too - :pinch:

    The reason for that blog post actually happens to be rooted in a previous QOTD - here

    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

  • Mighty (4/6/2016)


    According to this article a temporary table can be partitioned:

    http://jasonbrimhall.info/2014/05/23/can-you-partition-a-temporary-table/.

    So "Temporary tables cannot be partitioned" is not a limitation.

    Thanks Mighty, morlindk and Steve for the call-outs to the blog post.

    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

  • Ed Wagner (4/6/2016)


    TomThomson (4/6/2016)


    Why doesn't SQLServerCentral have <joke> <ekoj> tags? I'm not sure whether you picked up my intent and I'm also not sure whether I picked up yours.

    Fair enough - thank you. I didn't think it was possible and I may have been poking you a bit. 😉 I won't get into the difference between "different than" versus "different from" but do have one serious question for you:

    What is an <ejok> tag? The <joke> is simple enough, but I've not heard of <ejok> before. My guess would be e-Joke, but I would also guess that I'm wrong.

    Not <ejok>, but <ekoj>. In the bad old days several languages (eg Algol 68, if I remember correctly - certainly the two different ALgol 68 versions used by ICL and Burroughs but they weren't the official standard) had IF ... .... FI (instead of IF ... Begin .... End) and we messed around rather a lot so there were implemented (and used for production) languages that had NEGIB instead of END, and UNLESS....SSELNU instead of IF NOT (...)...FI. A bit later on we started doing it with tags delimited by <> or [], and lots of imaginary tag-pairs were invented. People stared doing things like like [joke]...[ekoj] instead of [joke]...[/joke] and <sarcasm> ... <msacras> instead of <sarcasm> ... </sarcasm>. The mainstream ditched spelling backward to indicate end (mostly - languages using FI were still in use last time I looked, and I'm told the S3 dialect of Algol 68 - invented at ICL in 1969 - is still in use at Fujitsu) and adopted things like <tag>....</tag>, but for some reason /BEGIN didn't replace END, and whichever was appropriate of /DO and /WHILE didn't replace REPEAT.

    Tom

  • I guess I've never used a temp table in a trigger.

  • TomThomson (4/6/2016)


    Ed Wagner (4/6/2016)


    TomThomson (4/6/2016)


    It was however easy to see which of them was the one that was wanted, just by looking at the wording - it was the only one not expressed as a negative; all the commenters complaining about "double negative" should have noticed that the one answer said "must have a different name than" (:sick: what a barbarous Americanism :laugh:)instead of "cannot have the same name as", avoiding the double negative, so was clearly the odd one out - ie the required answer.

    You aren't honestly saying you didn't understand the phrase "must have a different name than" with a straight face, are you? A man of your considerable experience must have encountered far worse than this.

    <snip>

    Of course I'm not saying that. Just saying that the American English language has "different than" in many cases where British English has "different from" and this is one of the cases where the American usage sounds particularly horrible to many British people.

    </snip>

    I was taught that correct American English usage is "different from", because "than" implies a ranking or rating of one entity being more or less something than the other, whereas "different" is just, well, different.

    Rich

  • I sometimes lapse into using "different than", but I usually use "different from". It's just more consistent, since I can say both "x is different from y" and "x differs from y", but not both "x is different than y" and "x differs than y". That last is, well, positively strange 🙂

  • Thanks for this interesting question. I have studied temporary tables after a previous QOD and I found the 2 correct choices ( 4 and 2 ).

    For the other possible choices , I had no knowledge ( especially the partitioned tables I have never studied ).

    But I was really interested by the others posts which learnt much about the differences between Great Britain and USA in language even if with the same name. So thanks for each poster...

  • patricklambin (4/7/2016)


    But I was really interested by the others posts which learnt much about the differences between Great Britain and USA in language even if with the same name. So thanks for each poster...

    As the saying goes: "Great Britain and United States - two countries divided by a common language"


    Just because you're right doesn't mean everybody else is wrong.

Viewing 15 posts - 16 through 30 (of 31 total)

You must be logged in to reply to this topic. Login to reply