Using statements with SQL
When you work with data in a SQL Server database by using the Microsoft JDBC Driver for SQL Server and inline SQL statements, there are different classes that you can use. Which class you use depends on the type of SQL statement that you want to run.
If your SQL statement contains no IN parameters, use the SQLServerStatement class, but if it does contain IN parameters, use the SQLServerPreparedStatement class.
Note
If you need to use SQL statements that contain both IN and OUT parameters, you must implement them as stored procedures and call them by using the SQLServerCallableStatement class. For more information about using stored procedures, see Using statements with stored procedures.
The following sections describe the different scenarios for working with data in a SQL Server database by using SQL statements.
In This Section
Topic | Description |
---|---|
Using a SQL statement with no parameters | Describes how to use SQL statements that contain no parameters. |
Using a SQL statement with parameters | Describes how to use SQL statements that contain parameters. |
Using a SQL statement to modify database objects | Describes how to use SQL statements to modify database objects. |
Using a SQL statement to modify data | Describes how to use SQL statements to modify data in a database. |