Why is using OPENQUERY on a local server bad?

后端 未结 3 1077
不知归路
不知归路 2021-02-09 19:18

I\'m writing a script that is supposed to run around a bunch of servers and select a bunch of data out of them, including the local server. The SQL needed to SELECT the data I n

3条回答
  •  再見小時候
    2021-02-09 19:55

    • Although the query may return multiple result sets, OPENQUERY returns only the first one.
    • OPENQUERY does not accept variables for its arguments.
    • OPENQUERY cannot be used to execute extended stored procedures on a linked server. However, an extended stored procedure can be executed on a linked server by using a four-part name.
    • If the sp_addlinkedserver stored procedure is used within same script, the credentials used on the remote server are hardcoded into the script, visible to anyone who has a copy

    Reference:

    • OPENQUERY

提交回复
热议问题