SSMS の Copilot は、SQL Server Management Studio (SSMS) のユーザーが SQL データベースを管理および開発するのを支援するように設計された高度な AI ツールです。 データベース管理者、データベース開発者、アプリケーション管理者、ビジネス アナリストなど、SSMS の Copilot を使用すると、時間を節約し、ワークフローの効率を高めることができます。
SSMS で Copilot を使用して、SQL Server、Azure SQL Database、Azure SQL Managed Instance、または Fabric の SQL Database のデータベースに関する質問に回答します。 自然言語 (NL2SQL) を使用した Transact-SQL (T-SQL) クエリの記述に関するサポートを要求することもできます。 Copilot は、エラー メッセージ、文書化、説明、および T-SQL クエリの修正にも役立つ場合があります。
データベースと環境の探索
サイドカー チャットで、任意の順序で Copilot に質問します。 例えば次が挙げられます。
What version of SQL is this?List the databases on this instance.List server configuration settings that have been changed from the default in table format with the setting and current valueHow do I find out who is connected to this database?What is the compatibility mode for the database?hat's the largest table in the database?What columns store email addresses?How many customers do we have and where are they located?Have any SQL Agent jobs have failed in the last week and if so, which ones?
マルチターン エクスペリエンス
Copilot に一連の質問をします。その後の各質問は、前の回答に関連するか、それに応答します。 例えば次が挙げられます。
What is the compatibility mode for this database?What is the latest compatibility mode available for this version of SQL?How do I change the compatibility mode?How will this change affect query performance?Give me step-by-step instructions for testing a change in compatibility mode for a query without changing the compatibility mode for the entire database.
スクリプトを使用したマルチターン エクスペリエンス
Copilot に一連の質問をする場合は、トピックに関連するクエリを作成するように依頼することもできます。
What is a database backup?What is the difference between a full and log backup?How do I create a database backup?Does my database need a transaction log backup?How do I create a transaction log backup?Create the script to backup the databaseHow do I automate backups?What should my backup schedule be if the RPO is 30 minutes?Create the script to create SQL Agent jobs for the recommended backup schedule
Copilot を使用して Transact-SQL に関するヘルプを表示する
SSMS の Copilot にはクエリ エディター接続に基づくコンテキストがありますが、現在、クエリ エディターに直接アクセスすることはできません。 具体的には、空のエディターを入力しても、Copilot アシスタンスは呼び出されません。 さらに、現在、エディターから直接読み取ったり (強調表示されている場合)、何かをコピーしたりすることはできません。
Transact-SQL を書く
Copilot は、サイドカー チャット内で指定したプロンプト (T-SQL または NLtoSQL に対する自然言語) を使用して T-SQL の記述を支援できます。
Write a query to return sales information for the last weekWrite a query to find all the customers who placed orders in July 2024 that totaled more than $1000 and order based on total descendingWrite the query to change the ReferenceID column in the Tickets table from an INT to a VARCHAR(25)Give me the query to find how much space is being used in tempdbGive me the query to find all open transactions
マルチターン エクスペリエンスとしての T-SQL クエリの作成に関するヘルプを表示する
クエリの作成に関するヘルプを Copilot に依頼するだけでなく、自分でクエリを記述するのと同じ方法で、チャットでのクエリ開発に関する支援を求めることができます。
How many customers spent over $100000 in 2023?Give me the query you ran to find that informationTake the inner query and change it to select customer ID, customer name, and total spent and order it by total spent descendingI forgot I want to include the state where the company is located in the output, please update the query to add that
データベース開発に Copilot を使用する
Copilot は、データベース内のオブジェクトをすばやく開発するのに役立ちます。
データベースの一連のテーブルを作成するように Copilot に依頼します。
We're designing a database for a fictional company called Contoso Wireless. They are similar to existing wireless companies in the sense that they sell cell phones, accessories, phone plans, chargers, headsets, and more. Can you suggest some tables that will support my application? This application will support browsing a website, creating orders, paying bills, tracking customer activity, tracking usage, etc. Please provide scripts to create all the tables you see fit and make sure each table has a clustered index for the primary key.インデックスを作成するように Copilot に依頼します。
Are there any indexes you think I need based on the kinds of queries that we will run to find data?サンプル データを作成するように Copilot に依頼します。
We need to generate data for each of the tables. Each table should have 100-1000 rows. The data needs to be realistic (we can't repeat names, products, etc.). Can you help generate scripts for that? It's ok if the scripts are long. Variability in the data is more important than having a short script. For the customers table, use a combination of 50 first names and 50 last names and also use 30 different city/state combinations.
その他の例
SQL または T-SQL の記述について、Copilot に質問できます。 AI は間違いを犯す可能性がありますので、実行前に常にスクリプトを確認してください。
List the 10 largest tables in the database based on row count in a bulleted listWhat are the file sizes for this database, their file growth settings, and how much free space do they have?What are the worst performing queries for the last hour?What queries executed most frequently in the last two hours?List all employes and their email address in comma delimited formatWhat are the top 5 products ordered the most in 2024?Calculate the total number of orders for each company in 2023Create a table named Offices in the Sales schema. It should have the columns officeID, office name, address, city, state, zip code, and office manager ID which is foreign key to the People table.