Answers

Question and Answer:

  Home  SQL Notification Services

⟩ Explain OPENQUERY function and OPENROWSET function?

OPENQUERY: - Used to execute the query passed on the linked server.

Syntax: OPENQUERY (Linked_server_identifier, query). It can also be refernced from a FROM clause of selecte query.

e.g. Select * from OPENQUERY (Oracleserver, ‘select fname, FROM Employee);

OPENROWSET: - Used to access tables in a linked server. It can be used one time for accessing remote data by using OLE DB. It includes all the information required to access the remote data.

Syntax:

OPENROWSET

( { 'provider_name' , { 'datasource' ; 'user_id' ; 'password'

| 'provider_string' }

, { [ catalog. ] [ schema. ] object

| 'query'

}

| BULK 'data_file' ,

{ FORMATFILE = 'format_file_path' [ ]

| SINGLE_BLOB | SINGLE_CLOB | SINGLE_NCLOB }

} )

 131 views

More Questions for you: