select top 5 * from openquery (PROD, 'select * from tblUser')
It works well.
Now, if you do not want to use openquery then
select top 5 * from prod.db_customer.dbo.tbluser
The syntax for running a query on a linked server without an open request is
LINKEDSERVERNAME.DATABASENAME.SCHEMANAME.TABLENAME
You can also execute a stored procedure, tables, and functions from this approach.
Query data from a table / view
Run a stored procedure
select top 5 fromprod.db_customer.dbo.tbluser exec prod.db_customer.dbo. [select_recent_requests] '123' Execute the procedure above, is it executed successfully? Yes then no problem. But a time error occurred as "Msg 7411, Level 16, State Server 1 is not configured for RPC". To resolve this error, go to Properties for your linked server. Check the server options. RPC is used to allow remote procedure calls "from" the linked server. RPC Out is used to allow remote procedure calls "to" the linked server.
No comments:
Post a Comment