--- title: "execute Method (java.lang.String) | Microsoft Docs" ms.custom: "" ms.date: "01/19/2017" ms.prod: sql ms.prod_service: connectivity ms.reviewer: "" ms.technology: connectivity ms.topic: conceptual apiname: - "SQLServerPreparedStatement.execute (java.lang.String)" apilocation: - "sqljdbc.jar" apitype: "Assembly" ms.assetid: a871917e-d286-46c3-96cf-2e8e8b22111c author: David-Engel ms.author: v-daenge --- # execute Method (java.lang.String) [!INCLUDE[Driver_JDBC_Download](../../../includes/driver_jdbc_download.md)] Runs the given SQL statement, which can return multiple results. ## Syntax ``` public final boolean execute(java.lang.String sql) ``` #### Parameters *sql* A **String** that contains an SQL statement. ## Return Value **true** if the statement returns a result set. **false** if it returns an update count or no result. ## Exceptions [SQLServerException](../../../connect/jdbc/reference/sqlserverexception-class.md) ## Remarks This execute method is specified by the execute method in the java.sql.Statement interface. This method overrides the [execute](../../../connect/jdbc/reference/execute-method-sqlserverstatement.md) method that is found in the [SQLServerStatement](../../../connect/jdbc/reference/sqlserverstatement-class.md) class. Calling this method will result in an exception since the SQL statement for the SQLServerPreparedStatement object is specified when the object is created. ## See Also [execute Method (SQLServerPreparedStatement)](../../../connect/jdbc/reference/execute-method-sqlserverpreparedstatement.md) [SQLServerPreparedStatement Members](../../../connect/jdbc/reference/sqlserverpreparedstatement-members.md) [SQLServerPreparedStatement Class](../../../connect/jdbc/reference/sqlserverpreparedstatement-class.md)