Problem with Delete On Linked Server

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Neil

    Problem with Delete On Linked Server

    I am getting time-out errors when I try to perform a simple delete on a
    linked server. The command is:

    Delete From MyTable Where PKID=12345

    I have tried executing this command directly from Query Analyzer, but it
    just times out. However, when I run it from QA against the server itself
    (rather than from my local server against a linked server), it executes
    immediately. Similarly, if I run the same SQL command through an ODBC linked
    table in an Access 2000 MDB file (tweaking the syntax slightly), it also
    executes immediately. Only if I run it from SQL 7 as a stored procedure or a
    QA command against a linked server does it time-out.

    I have no problems inserting rows using any of the three methods noted
    above. It is only with deleting rows through the linked server that it times
    out.

    Thanks for any assistance.

    Neil


  • Neil

    #2
    Re: Problem with Delete On Linked Server

    Correction: The syntax used against the linked server is the four-art
    syntax:

    Delete From svr.db.dbo.MyTa ble Where PKID=12345

    Also, the same problem occurs with updates as with deletes (but not
    inserts).

    Thanks,

    Neil


    "Neil" <nospam@nospam. net> wrote in message
    news:_Jqag.5464 $u4.5402@newsre ad1.news.pas.ea rthlink.net...[color=blue]
    >I am getting time-out errors when I try to perform a simple delete on a
    >linked server. The command is:
    >
    > Delete From MyTable Where PKID=12345
    >
    > I have tried executing this command directly from Query Analyzer, but it
    > just times out. However, when I run it from QA against the server itself
    > (rather than from my local server against a linked server), it executes
    > immediately. Similarly, if I run the same SQL command through an ODBC
    > linked table in an Access 2000 MDB file (tweaking the syntax slightly), it
    > also executes immediately. Only if I run it from SQL 7 as a stored
    > procedure or a QA command against a linked server does it time-out.
    >
    > I have no problems inserting rows using any of the three methods noted
    > above. It is only with deleting rows through the linked server that it
    > times out.
    >
    > Thanks for any assistance.
    >
    > Neil
    >[/color]


    Comment

    • Neil

      #3
      Re: Problem with Delete On Linked Server

      I ran a profiler trace while inserting and then deleting a row from the
      table on the linked server. I added all events to the trace. However, for
      both the insert and delete, it only showed a single SQL:BatchComple ted
      event -- except that after the line for the delete command, there was a
      second, blank, line in the trace. The two lines for the delete didn't show
      in the profiler until the batch was canceled. Below are the lines from
      Profiler. Any assistance is appreciated.

      Thanks,

      Neil

      Event Class Text Application Name NT User Name SQL User Name CPU Reads
      Writes Duration Connection ID SPID Start Time
      +SQL:BatchCompl eted insert into abcweb.abc.dbo. images (ImageID) values
      (99986) MS SQL Query Analyzer neil sa 0 13 0 640 5264 12 02:23:31.450
      +SQL:BatchCompl eted Delete From abcweb.abc.dbo. images Where ImageID=99986
      MS SQL Query Analyzer neil sa 0 20 1 14440 5264 12 02:23:42.387
      SQL:BatchComple ted MS SQL Query Analyzer neil sa 0 0 0 0 5264 12
      02:23:56.827



      "Neil" <nospam@nospam. net> wrote in message
      news:_Jqag.5464 $u4.5402@newsre ad1.news.pas.ea rthlink.net...[color=blue]
      >I am getting time-out errors when I try to perform a simple delete on a
      >linked server. The command is:
      >
      > Delete From MyTable Where PKID=12345
      >
      > I have tried executing this command directly from Query Analyzer, but it
      > just times out. However, when I run it from QA against the server itself
      > (rather than from my local server against a linked server), it executes
      > immediately. Similarly, if I run the same SQL command through an ODBC
      > linked table in an Access 2000 MDB file (tweaking the syntax slightly), it
      > also executes immediately. Only if I run it from SQL 7 as a stored
      > procedure or a QA command against a linked server does it time-out.
      >
      > I have no problems inserting rows using any of the three methods noted
      > above. It is only with deleting rows through the linked server that it
      > times out.
      >
      > Thanks for any assistance.
      >
      > Neil
      >[/color]


      Comment

      • Sue Hoegemeier

        #4
        Re: Problem with Delete On Linked Server

        Which box were you running the trace against? Try running it
        against the destination (the linked server) instead of the
        server that you are executing the command from.
        Another thing to see if it works - try executing the
        statement using OpenQuery instead of the 4 part name and see
        if that makes a difference.

        -Sue

        On Wed, 17 May 2006 06:23:30 GMT, "Neil" <nospam@nospam. net>
        wrote:
        [color=blue]
        >I ran a profiler trace while inserting and then deleting a row from the
        >table on the linked server. I added all events to the trace. However, for
        >both the insert and delete, it only showed a single SQL:BatchComple ted
        >event -- except that after the line for the delete command, there was a
        >second, blank, line in the trace. The two lines for the delete didn't show
        >in the profiler until the batch was canceled. Below are the lines from
        >Profiler. Any assistance is appreciated.
        >
        >Thanks,
        >
        >Neil
        >
        >Event Class Text Application Name NT User Name SQL User Name CPU Reads
        >Writes Duration Connection ID SPID Start Time
        >+SQL:BatchComp leted insert into abcweb.abc.dbo. images (ImageID) values
        >(99986) MS SQL Query Analyzer neil sa 0 13 0 640 5264 12 02:23:31.450
        >+SQL:BatchComp leted Delete From abcweb.abc.dbo. images Where ImageID=99986
        >MS SQL Query Analyzer neil sa 0 20 1 14440 5264 12 02:23:42.387
        > SQL:BatchComple ted MS SQL Query Analyzer neil sa 0 0 0 0 5264 12
        >02:23:56.827
        >
        >
        >
        >"Neil" <nospam@nospam. net> wrote in message
        >news:_Jqag.546 4$u4.5402@newsr ead1.news.pas.e arthlink.net...[color=green]
        >>I am getting time-out errors when I try to perform a simple delete on a
        >>linked server. The command is:
        >>
        >> Delete From MyTable Where PKID=12345
        >>
        >> I have tried executing this command directly from Query Analyzer, but it
        >> just times out. However, when I run it from QA against the server itself
        >> (rather than from my local server against a linked server), it executes
        >> immediately. Similarly, if I run the same SQL command through an ODBC
        >> linked table in an Access 2000 MDB file (tweaking the syntax slightly), it
        >> also executes immediately. Only if I run it from SQL 7 as a stored
        >> procedure or a QA command against a linked server does it time-out.
        >>
        >> I have no problems inserting rows using any of the three methods noted
        >> above. It is only with deleting rows through the linked server that it
        >> times out.
        >>
        >> Thanks for any assistance.
        >>
        >> Neil
        >>[/color]
        >[/color]

        Comment

        • Neil

          #5
          Re: Problem with Delete On Linked Server

          Couldn't run a trace against the linked server, as I don't have permissions
          to execute the trace sp. Sent a note to the web admin to give me
          permissions.

          In the meantime, I used OpenQuery as you suggested. This time at least I got
          an error message (yea!), though somewhat cryptic:

          "Could not process object 'Delete From images Where ImageID=99986'. The
          OLE DB provider 'SQLOLEDB' indicates that the object has no columns."

          Any ideas about what that means?

          Thanks!

          Neil


          "Sue Hoegemeier" <Sue_H@nomail.p lease> wrote in message
          news:bh9m62hksv saa8fdoob0sphsd 32jgqc36h@4ax.c om...[color=blue]
          > Which box were you running the trace against? Try running it
          > against the destination (the linked server) instead of the
          > server that you are executing the command from.
          > Another thing to see if it works - try executing the
          > statement using OpenQuery instead of the 4 part name and see
          > if that makes a difference.
          >
          > -Sue
          >
          > On Wed, 17 May 2006 06:23:30 GMT, "Neil" <nospam@nospam. net>
          > wrote:
          >[color=green]
          >>I ran a profiler trace while inserting and then deleting a row from the
          >>table on the linked server. I added all events to the trace. However, for
          >>both the insert and delete, it only showed a single SQL:BatchComple ted
          >>event -- except that after the line for the delete command, there was a
          >>second, blank, line in the trace. The two lines for the delete didn't show
          >>in the profiler until the batch was canceled. Below are the lines from
          >>Profiler. Any assistance is appreciated.
          >>
          >>Thanks,
          >>
          >>Neil
          >>
          >>Event Class Text Application Name NT User Name SQL User Name CPU Reads
          >>Writes Duration Connection ID SPID Start Time
          >>+SQL:BatchCom pleted insert into abcweb.abc.dbo. images (ImageID) values
          >>(99986) MS SQL Query Analyzer neil sa 0 13 0 640 5264 12 02:23:31.450
          >>+SQL:BatchCom pleted Delete From abcweb.abc.dbo. images Where ImageID=99986
          >>MS SQL Query Analyzer neil sa 0 20 1 14440 5264 12 02:23:42.387
          >> SQL:BatchComple ted MS SQL Query Analyzer neil sa 0 0 0 0 5264 12
          >>02:23:56.82 7
          >>
          >>
          >>
          >>"Neil" <nospam@nospam. net> wrote in message
          >>news:_Jqag.54 64$u4.5402@news read1.news.pas. earthlink.net.. .[color=darkred]
          >>>I am getting time-out errors when I try to perform a simple delete on a
          >>>linked server. The command is:
          >>>
          >>> Delete From MyTable Where PKID=12345
          >>>
          >>> I have tried executing this command directly from Query Analyzer, but it
          >>> just times out. However, when I run it from QA against the server itself
          >>> (rather than from my local server against a linked server), it executes
          >>> immediately. Similarly, if I run the same SQL command through an ODBC
          >>> linked table in an Access 2000 MDB file (tweaking the syntax slightly),
          >>> it
          >>> also executes immediately. Only if I run it from SQL 7 as a stored
          >>> procedure or a QA command against a linked server does it time-out.
          >>>
          >>> I have no problems inserting rows using any of the three methods noted
          >>> above. It is only with deleting rows through the linked server that it
          >>> times out.
          >>>
          >>> Thanks for any assistance.
          >>>
          >>> Neil
          >>>[/color]
          >>[/color]
          >[/color]


          Comment

          • Neil

            #6
            Re: Problem with Delete On Linked Server

            OK, I found out that the error I got originally (per other message) was due
            to the fact that Delete doesn't return rows, as OpenQuery is looking for.
            So, per http://support.microsoft.com/default...;en-us;Q270119, I
            changed it to:

            Delete OPENQUERY(abcwe b, 'Select ImageID From images Where
            ImageID=99987')

            and it worked! Would still be good to find out why the original method
            wouldn't work for deletes or updates, but did work for inserts. But at least
            this works.

            Thanks!

            Neil


            "Sue Hoegemeier" <Sue_H@nomail.p lease> wrote in message
            news:bh9m62hksv saa8fdoob0sphsd 32jgqc36h@4ax.c om...[color=blue]
            > Which box were you running the trace against? Try running it
            > against the destination (the linked server) instead of the
            > server that you are executing the command from.
            > Another thing to see if it works - try executing the
            > statement using OpenQuery instead of the 4 part name and see
            > if that makes a difference.
            >
            > -Sue
            >
            > On Wed, 17 May 2006 06:23:30 GMT, "Neil" <nospam@nospam. net>
            > wrote:
            >[color=green]
            >>I ran a profiler trace while inserting and then deleting a row from the
            >>table on the linked server. I added all events to the trace. However, for
            >>both the insert and delete, it only showed a single SQL:BatchComple ted
            >>event -- except that after the line for the delete command, there was a
            >>second, blank, line in the trace. The two lines for the delete didn't show
            >>in the profiler until the batch was canceled. Below are the lines from
            >>Profiler. Any assistance is appreciated.
            >>
            >>Thanks,
            >>
            >>Neil
            >>
            >>Event Class Text Application Name NT User Name SQL User Name CPU Reads
            >>Writes Duration Connection ID SPID Start Time
            >>+SQL:BatchCom pleted insert into abcweb.abc.dbo. images (ImageID) values
            >>(99986) MS SQL Query Analyzer neil sa 0 13 0 640 5264 12 02:23:31.450
            >>+SQL:BatchCom pleted Delete From abcweb.abc.dbo. images Where ImageID=99986
            >>MS SQL Query Analyzer neil sa 0 20 1 14440 5264 12 02:23:42.387
            >> SQL:BatchComple ted MS SQL Query Analyzer neil sa 0 0 0 0 5264 12
            >>02:23:56.82 7
            >>
            >>
            >>
            >>"Neil" <nospam@nospam. net> wrote in message
            >>news:_Jqag.54 64$u4.5402@news read1.news.pas. earthlink.net.. .[color=darkred]
            >>>I am getting time-out errors when I try to perform a simple delete on a
            >>>linked server. The command is:
            >>>
            >>> Delete From MyTable Where PKID=12345
            >>>
            >>> I have tried executing this command directly from Query Analyzer, but it
            >>> just times out. However, when I run it from QA against the server itself
            >>> (rather than from my local server against a linked server), it executes
            >>> immediately. Similarly, if I run the same SQL command through an ODBC
            >>> linked table in an Access 2000 MDB file (tweaking the syntax slightly),
            >>> it
            >>> also executes immediately. Only if I run it from SQL 7 as a stored
            >>> procedure or a QA command against a linked server does it time-out.
            >>>
            >>> I have no problems inserting rows using any of the three methods noted
            >>> above. It is only with deleting rows through the linked server that it
            >>> times out.
            >>>
            >>> Thanks for any assistance.
            >>>
            >>> Neil
            >>>[/color]
            >>[/color]
            >[/color]


            Comment

            Working...