Highlight the Alter Database portion of the text again, and then select the Decrease Indent button to move this text back. Highlight the Alter Database portion of the text, and then select the Increase Indent button on the toolbar to move this text forward: Paste the following Transact-SQL code in your text window: USE master You can use the indentation buttons on the toolbar to increase or decrease the indent of your text. The keyboard shortcut to uncomment text is CTRL + K, CTRL + U. Highlight everything except for the Alter Database command, and then select the Comment button: Select Execute to run the uncommented portion of the text. Highlight the Alter Database portion of the text, and then select the Comment button on the toolbar: Drop the database if it already existsĪLTER DATABASE SET QUERY_STORE=ON Paste the following Transact-SQL code in your text window. Text that is commented out is not executed. You can comment and uncomment portions of your text by using the Comment button on the toolbar.
To learn how to restore a database in SSMS, see Restoring a database. Download an AdventureWorks sample database.To test out the steps provided in this article, you need SQL Server Management Studio, access to a SQL server, and an AdventureWorks database.
Find the name of your SQL Server instance.Comment/uncomment your Transact-SQL (T-SQL) text.