Variable Array Table

  • lukus_g (10/12/2010)


    Hugo Kornelis, you are a ninja!

    True! Well, except for the trendy clothes, the superior stealth, the extreme strength and endurance, the ability to kill without getting killed or caught, and the generic sheer awesomeness of course.:-D

    But thanks anyway!:-)


    Hugo Kornelis, SQL Server/Data Platform MVP (2006-2016)
    Visit my SQL Server blog: https://sqlserverfast.com/blog/
    SQL Server Execution Plan Reference: https://sqlserverfast.com/epr/

  • Interesting question. Good follow on discussion.

  • This question completely wasted my time. It serves little use to anybody.

  • I felt it was worth two points , sure stumped me.

    Make you think outside the box.

    Thank you

  • Carlo, nice try with this Question of the Day, but I really learned more with Hugo's explanation......

    _______________________________________________________________________
    For better assistance in answering your questions, click here[/url]

  • I just think it's hilareous what the SQL 2008 intellisense looks like (newline characters and all) when you perform a select against this 'table':

    select dbo.[VarArray[]](i int)

    GO

    begin tran

    insert into VarArray(i) select 1;

    print 1;

    rollback

    GO

    while(1=1)].print_i

    from dbo.[VarArray[]](i int)

    GO

    begin tran

    insert into VarArray(i) select 1;

    print 1;

    rollback

    GO

    while(1=1)]

    What a strange question... My first impression was that this was done by mistake when trying to use VARARRAY from Oracle (or someone was testing to see if VARARRAY was valid in that version of SQL Server).

  • You are right. The parser in SSMS 2008 is a little different from 2005. The table name has the actual insert statement in it and then some. I wasted 20-30 minutes trying to get it to work like the posted answer.

  • Hugo, thank you for your explanation. I was totally confused by the square brackets.

  • I thought the ending ] was a typo, it just didn't make sense with it there 🙂

  • I think I wasted 15 min of my time today on this question learning nothing new, thanks Hugo for taking the time to explain the delimiter concepts.

  • Interesting question with totally useless (or worse than that) explanation.

    Thank heavens for Hugo's clear and simple explanation!

    Tom

  • Dogpile on Carlo. Give him a dutch rub. 😉

  • First time I've ever joined a QOTD discussion. In almost 10 years on the site this must be the worst QOTD yet. I quite regularly get them wrong as I am a part time user of SQL Server now days having got promoted to PM roll. I enjoy the learnings and encourage my teams to spend time on the forums and to always do the QOTD. Well this one is a total waste of time as it is a situation that will NEVER occur in a real world situation. I know that it is voluntary to submit a question and there are probalby times when only one is submitted ut I would prefer to have no QOTD that ones as bad as this.

  • dogramone (10/12/2010)


    First time I've ever joined a QOTD discussion.

    No, there have been far worse. At least in this one the answer was not wrong. And for irrelevance to real work - one QoTD that I set beats this one for irrelevance (and Hugo quite properly and politely pointed out its irrelevance).

    Tom

  • That was a realy trick question. Thank you Hugo for the explanation. I had to read it twice, but I finaly got it... Sure I know how a ] works now!

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

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