(Component Integration Services only) Defines a default storage location for objects in a local database.
sp_defaultloc dbname, defaultloc, defaulttype
server.dbname.owner.
table – indicates that the object named by object_loc is a table accessible to a remote server. This value is the default for defaulttype.
view – indicates that the object named by object_loc is a view managed by a remote server, processed as a table.
rpc – indicates that the object named by object_loc is an RPC managed by a remote server; processes the result set from the RPC as a read-only table.
sp_defaultloc pubs, MYSERVER.pubs.dbo., table create table pubs.dbo.book1 (bridges char(15))
sp_defaultloc pubs, NULL
sp_defaultloc ticktape, wallst.nasdaq.dbo., rpc create existing table sybase (bestbuy integer)
sp_defaultloc defines a default storage location for tables in a local database. It maps table names in a database to a remote location. It permits the user to establish a default for an entire database, rather than issue an sp_addobjectdef command before every create table and create existing table command.
server_name.dbname.owner.
Note that the defaultloc specification ends in a period (.).
server_name represents a server already added to sysservers by sp_addserver. The server_name parameter is required.
dbname might not be required. Some server classes do not support it.
owner should always be provided to avoid ambiguity. If it is not provided, the remote object actually referenced could vary, depending on whether the external login corresponds to the remote object owner.
Issue sp_defaultloc before any create table or create existing table statement. When either statement is used, the server uses the sysattributes table to determine whether any table mapping has been specified for the object about to be created or defined. If the mapping has been specified, a create table statement directs the table to be created at the location specified by object_loc. A create existing table statement stores information about the existing remote object in the local table.
If you issue sp_defaultloc on defaulttype view and then issue create table, Component Integration Services creates a new table, not a view, on the remote server.
Changing the default location for a database does not affect tables that have previously been mapped to a different default location.
After tables in the database have been created, all future references to tables in dbname (by select, insert, delete, and update) are mapped to the correct location.
See also create existing table, create table in Reference Manual: Commands.
Any user can execute sp_defaultloc. Permission checks do not differ based on the granular permissions settings.
Values in event and extrainfo columns from the sysaudits table are:
Information | Values |
---|---|
Event | 38 |
Audit option | exec_procedure |
Command or access audited | Execution of a procedure |
Information in extrainfo |
|