Output Parameter

  • good question!!!!!


    [font="Times New Roman"]rfr.ferrari[/font]
    DBA - SQL Server 2008
    MCITP | MCTS

    remember is live or suffer twice!
    the period you fastest growing is the most difficult period of your life!
  • tks for the question - tks to all who weighed in already - nothing more I can say other than I agree...

    Happy Monday πŸ™‚

  • A good way to start the short week! Thanks!

  • Ninja's_RGR'us (11/21/2011)


    I should get a macro program to be able to just hit something like ctrl-alt-shit-i :-D.

    Is that key only on Canadian keyboards? I don't think I have one of those on mine.

    ______________________________________________________________________________________________
    Forum posting etiquette.[/url] Get your answers faster.

  • calvo (11/21/2011)


    Ninja's_RGR'us (11/21/2011)


    I should get a macro program to be able to just hit something like ctrl-alt-shit-i :-D.

    Is that key only on Canadian keyboards? I don't think I have one of those on mine.

    Which one?

  • Ninja's_RGR'us (11/21/2011)


    calvo (11/21/2011)


    Ninja's_RGR'us (11/21/2011)


    I should get a macro program to be able to just hit something like ctrl-alt-shit-i :-D.

    Is that key only on Canadian keyboards? I don't think I have one of those on mine.

    Which one?

    I've bolded it in the quotation so you can see. πŸ™‚

    Tom

  • L' Eomot InversΓ© (11/21/2011)


    Ninja's_RGR'us (11/21/2011)


    calvo (11/21/2011)


    Ninja's_RGR'us (11/21/2011)


    I should get a macro program to be able to just hit something like ctrl-alt-shit-i :-D.

    Is that key only on Canadian keyboards? I don't think I have one of those on mine.

    Which one?

    I've bolded it in the quotation so you can see. πŸ™‚

    Also called the vista windows key by some :w00t:

  • Thanks for the question - perfect for getting my brain back to room temperature on a Monday.

  • I knew this one from experience :blush:

  • It's becoming more a game of 'what point is the questioner really trying to make' than actually looking at the code and working out the answer. Maybe everyone could put an 'IT DEPENDS' answer on their questions?

  • Damn, I knew that the output params were not being used and returned by the procedure.

    Still I was too fast to click the wrong answer. :blush:

    But TOP(1) with no ORDER BY on a table with no primary key doesn't make the options very accurate, does it?

    Nevertheless it's a nice tricky question. Thank you. πŸ™‚

    Best regards,

    Best regards,

    Andre Guerreiro Neto

    Database Analyst
    http://www.softplan.com.br
    MCITPx1/MCTSx2/MCSE/MCSA

  • Thanks for the question. I got it right for the wrong reason.

    http://brittcluff.blogspot.com/

  • Hi,

    Before answering the question. i tested with test data like

    declare @test-2 table(mm varchar(10))

    INSERT INTO @test-2 VALUES ('TEST')

    INSERT INTO @test-2 VALUES ('abc')

    INSERT INTO @test-2 VALUES ('145.87')

    INSERT INTO @test-2 VALUES ('1059.31')

    INSERT INTO @test-2 VALUES ('38.49')

    insert into @test-2 values('bnsdjsd')

    the answer is test.

    SELECT TOP 1 mm FROM @test-2 .I know that results will vary for every execution if we did not mentioned order by.but here even though i executed several time its giving the same answer.so i got this answer correct.

    Then i tested with below code

    declare @test-2 table(mm varchar(10))

    INSERT INTO @test-2 VALUES ('145.87')

    INSERT INTO @test-2 VALUES ('TEST')

    INSERT INTO @test-2 VALUES ('abc')

    INSERT INTO @test-2 VALUES ('1059.31')

    INSERT INTO @test-2 VALUES ('38.49')

    insert into @test-2 values('bnsdjsd')

    SELECT TOP 1 mm FROM @test-2

    its giving the output '145.87'.

    I think the above result depends on the insert statement.which ever first inserted it is showing that only.Please clarify

    me if am wrong.

    Malleswarareddy
    I.T.Analyst
    MCITP(70-451)

  • malleswarareddy_m (12/22/2011)


    I think the above result depends on the insert statement.which ever first inserted it is showing that only.Please clarify

    me if am wrong.

    You are somewhat right and somewhat wrong.

    The table has no keys or clustered index defined, so the storage structure is a heap. When querying heaps, rows will usually be returned in the order in which they were inserted. This is not guaranteed, however.


    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/

  • Hugo Kornelis (12/22/2011)


    malleswarareddy_m (12/22/2011)


    I think the above result depends on the insert statement.which ever first inserted it is showing that only.Please clarify

    me if am wrong.

    You are somewhat right and somewhat wrong.

    The table has no keys or clustered index defined, so the storage structure is a heap. When querying heaps, rows will usually be returned in the order in which they were inserted. This is not guaranteed, however.

    Ya,i know that if we defined any index than the result set is dependeds on the index.(asc,desc).if there was no index defined than the results will returned in the order in which they were inserted right?

    Malleswarareddy
    I.T.Analyst
    MCITP(70-451)

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

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