SQL Server Performance

Using a paramter in OPENQUERY

Discussion in 'T-SQL Performance Tuning for Developers' started by snamoglu, Feb 27, 2003.

  1. snamoglu New Member

    We have a pair of linked SQL servers that are experiencing performance issues on doing an update. OPENQUERY seems like the way to go, but we've got a parameter in our command, and are getting an error when trying to prepare the variable. Looks like the error is being reported by the remote server. Does anyone know how to do this?

    Here is an example.

    declare @x as nvarchar(30)
    set @x = 'R042151-998028'

    UPDATE
    openquery(efrontoffice, "select * from
    eFRONTOFFICE.clientele73.db:confused:rdItem WHERE uItemRef= @x" )
    SET changedate=GETDATE()


    Errors:
    Server: Msg 8180, Level 16, State 1, Line 3
    Statement(s) could not be prepared.
    Server: Msg 137, Level 15, State 1, Line 3
    Must declare the variable '@x'.

  2. snamoglu New Member

Share This Page