How to Use the ‘sp_server_info’ Stored Procedure in SQL Server

In SQL Server the sp_server_info system stored procedure returns a list of attribute names and matching values for SQL Server, the database gateway, or the underlying data source. It returns a subset of the information provided by SQLGetInfo in ODBC.

Basically, it allows you to see information about SQL Server.

Continue reading

Return Primary Keys from a Linked Server in SQL Server (T-SQL Examples)

In SQL Server you can use the sp_primarykeys system stored procedure to return the primary key columns from a specified linked server. It returns one row per key column, for the specified remote table.

The simplest way to execute this stored procedure is to pass the name of the linked server. Doing that will return all primary keys from the default database on the specified linked server.

You also have the option of specifying a different database and/or a specific table schema.

Continue reading

Return Table Privileges from a Linked Server in SQL Server (T-SQL Examples)

In SQL Server you can use the sp_table_privileges_ex system stored procedure to return privilege information about a specified table from a specified linked server.

You can specify an individual table, or you can specify all tables from a given database or table schema. You can also use wildcard characters to specify the table/s. However, you can also specify whether the wildcard characters should be interpreted as wildcard characters.

Continue reading

Return a List of Tables from a Linked Server in SQL Server (T-SQL Examples)

In SQL Server you can use the sp_tables_ex system stored procedure to return table information about the tables from a specified linked server.

The simplest way to execute this stored procedure is to pass the name of the linked server. Doing that will return all tables from the default database on the specified linked server, including system tables and views. This could be a big list.

You also have the option of specifying a different database and/or a specific table schema. You can also filter the results based on the table type (e.g. table, view, system table, etc).

Continue reading