How to: Edit the Test.sql Script to Run SQL Objects
The Test.sql file is where you add Transact-SQL statements that perform the necessary actions to test the database objects in a SQL Server project.
Note
In Visual C++, this file is named debug.sql. If you are using Visual C++ to run SQL objects, replace Test.sql with debug.sql in the instructions below.
For example, if your SQL Server project contains a stored procedure, you would add to the Test.sql script a line of SQL that executes the stored procedure. If the stored procedure does not provide any output, then you might want to add a SQL statement that returns some of the data manipulated by the stored procedure to verify that it executes as expected. Similarly, to test a trigger, your Test.sql file should contain a statement that performs the action that causes the trigger to execute, such as inserting or deleting a row.
The results of the Test.sql script are displayed in the Output window under the Database option in Visual Studio so that you can determine whether your database objects are working correctly.
To edit the Test.sql file in a SQL Server project
Open Solution Explorer by choosing Solution Explorer from the View menu.
Expand the Test Scripts folder.
Double-click the Test.sql file to open it in the SQL Editor.
Add a Transact-SQL statement that will provide results confirming the functionality of your project's database objects. For more information on creating a Test.sql script for the specific items in a SQL Server project, see the following pages:
For stored procedures, see How to: Create and Run a CLR SQL Server Stored Procedure.
For triggers, see How to: Create and Run a CLR SQL Server Trigger.
For user-defined functions, see How to: Create and Run a CLR SQL Server User-Defined Function.
For user-defined types, see How to: Create and Run a CLR SQL Server User-Defined Type.
For aggregates, see How to: Create and Run a CLR SQL Server Aggregate.
See Also
Tasks
Walkthrough: Creating a Stored Procedure in Managed Code
Concepts
Advantages of Using Managed Code to Create Database Objects