| title | Performing catalog operations | |
|---|---|---|
| description | Describes how to execute commands that modify database schema. | |
| author | David-Engel | |
| ms.author | davidengel | |
| ms.reviewer | v-chmalh | |
| ms.date | 11/25/2020 | |
| ms.service | sql | |
| ms.subservice | connectivity | |
| ms.topic | how-to | |
| dev_langs |
|
[!INCLUDE dotnet-all]
[!INCLUDEDriver_ADONET_Download]
To execute a command to modify a database or catalog, such as the CREATE TABLE or CREATE PROCEDURE statement, create a Command object using the appropriate SQL statements and a Connection object. Execute the command with the xref:Microsoft.Data.SqlClient.SqlCommand.ExecuteNonQuery%2A method of the xref:Microsoft.Data.SqlClient.SqlCommand object.
The following code example creates a stored procedure in a Microsoft SQL Server database.
[!code-csharpDataWorks SqlCommand.ExecuteNonQuery#3]