Sdílet prostřednictvím


Query Tools

You can use the following tools to access and change data in instances of SQL Server:

  • SQL Server Management Studio 

  • sqlcmd utility

  • bcp utility

  • sqlps utility

SQL Server Tools

SQL Server Management Studio provides two ways to access and change data:

  • From the File menu or the New Query and Database Engine Query buttons in the toolbar, you can open a Database Engine Query window. In the Database Engine Query window you can interactively code Transact-SQL and XQuery statements to query databases and change the data. You can save the statements as script files that can then be run using the sqlcmd utility. The Database Engine Query Editor supports dynamic F1 help, auto-completion, code outlining, a Transact-SQL debugger, IntelliSense, and other productivity aids.

  • In the Object Explorer, you can right-click tables or views and select menu items that let you select or edit rows.

The sqlcmd utility is a Microsoft Win32 command-prompt utility for:

  • Ad hoc, interactive running of Transact-SQL and XQuery statements.

  • Running Transact-SQL and XQuery script files.

To use sqlcmd, you must understand the Transact-SQL and XQuery programming languages. sqlcmd uses the SQL Server Native Client OLE DB provider API. This replaces the osql command prompt utility that is based on the ODBC API.

The bcp utility can be used to insert lots of rows into SQL Server tables. This utility requires no knowledge of Transact-SQL; however, you must understand the structure of the tables into which the new rows are being copied, and also the types of data that are valid for the rows in the table.

The sqlps utility is a Microsoft C# command-prompt utility for:

  • Ad hoc, interactive running of PowerShell commands.

  • Running PowerShell script files.

The sqlps utility loads and registers the SQL Server PowerShell provider. You can use this to navigate the SQL Server management object models by using paths similar to file system paths. The Run-Sqlcmd cmdlet lets you run script files that contain the Transact-SQL and XQuery statements supported by the sqlcmd utility.

You can use SQL Server Management Studio and the sqlps utility to connect to and administer multiple instances of SQL Server at the same time. The sqlcmd and bcp utilities let you connect with only one instance of SQL Server at a time.