OPENQUERY-1

  • timwell (3/17/2014)


    I have a question.

    I got crossed up because the documentation says that sp_serveroption and openquery are for connecting to remote or linked servers. I was thinking the delete was happening on some theoretical remote server that may or may not have a tempdb.dbo.a table.

    So in the example, is it connecting back to the server you are running the query from as if it is a "remote" server?

    yes.

    exec sp_serveroption @server = MyServer,@optname = 'DATA ACCESS',@optvalue = 'TRUE'

  • These queries demonstrate the two different connection:

    select @@SPID

    SELECT * FROM OPENQUERY(MyServer,'select @@SPID')

  • nice question..

  • Steven.Howes (3/17/2014)


    I really have to try answering these later in the day(when I'm more awake). I choose '1'. I didn't realize that I was suppose to choose the number of rows. Being honest, I still don't know if I would have guessed '2'

    Great question.

    +1

    Thanks & Best Regards,
    Hany Helmy
    SQL Server Database Consultant

  • Thomas Abraham (3/17/2014)


    Thanks for the question, Carlo.

    Don't know which is more interesting - the option for -1 rows, or the fact that 3% selected it as their answer!

    -1 😀

    Thanks & Best Regards,
    Hany Helmy
    SQL Server Database Consultant

  • [Incorrect answers: 80%], hmmm interesting.

    Thanks & Best Regards,
    Hany Helmy
    SQL Server Database Consultant

  • Hany Helmy (3/18/2014)


    Thomas Abraham (3/17/2014)


    Thanks for the question, Carlo.

    Don't know which is more interesting - the option for -1 rows, or the fact that 3% selected it as their answer!

    -1 😀

    Nooooooooooooo! 😀

    Always the minus Number One!

  • crussell-931424 (3/18/2014)


    It's still a little confusing.

    About?

  • I'm not sure I completely understand this.

    Is this what's going on?

    -The query initially adds a single row with a value of 1.

    - The open query returns the deleted set which is a single row with a value of 1; however, the delete is rolled back so the initial row stays there.

    - The 'deleted' set is then inserted into a, so it ends up with 2 rows with a value of 1.

  • Interesting Q, thanks

    Hope this helps...

    Ford Fairlane
    Rock and Roll Detective

  • marcia.j.wilson (3/18/2014)


    I'm not sure I completely understand this.

    Is this what's going on?

    -The query initially adds a single row with a value of 1.

    - The open query returns the deleted set which is a single row with a value of 1; however, the delete is rolled back so the initial row stays there.

    - The 'deleted' set is then inserted into a, so it ends up with 2 rows with a value of 1.

    Exactly!

  • Carlo Romagnano (3/19/2014)


    marcia.j.wilson (3/18/2014)


    I'm not sure I completely understand this.

    Is this what's going on?

    -The query initially adds a single row with a value of 1.

    - The open query returns the deleted set which is a single row with a value of 1; however, the delete is rolled back so the initial row stays there.

    - The 'deleted' set is then inserted into a, so it ends up with 2 rows with a value of 1.

    Exactly!

    Thanks for the confirmation. It took me a while to get my brain wrapped around this and even then I wasn't sure I was right.

  • Hany Helmy (3/18/2014)


    [Incorrect answers: 80%], hmmm interesting.

    About 36 hours later and the error rate is down to 70%. But still 3% selecting the answer "-1". Definitely interesting.

    Tom

  • TomThomson (3/19/2014)


    Hany Helmy (3/18/2014)


    [Incorrect answers: 80%], hmmm interesting.

    About 36 hours later and the error rate is down to 70%. But still 3% selecting the answer "-1". Definitely interesting.

    I got the wrong answer, but at least -1 was never a consideration for me.

  • marcia.j.wilson (3/19/2014)


    TomThomson (3/19/2014)


    Hany Helmy (3/18/2014)


    [Incorrect answers: 80%], hmmm interesting.

    About 36 hours later and the error rate is down to 70%. But still 3% selecting the answer "-1". Definitely interesting.

    I got the wrong answer, but at least -1 was never a consideration for me.

    Nor for me. I can't imagine how 24 people came to pick that answer.

    Tom

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

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