--- title: "execute Method (java.lang.String, java.lang.String) | Microsoft Docs" ms.custom: "" ms.date: "01/19/2017" ms.prod: "sql" ms.prod_service: "drivers" ms.service: "" ms.component: "jdbc" ms.reviewer: "" ms.suite: "sql" ms.technology: - "drivers" ms.tgt_pltfrm: "" ms.topic: "article" apiname: - "SQLServerStatement.execute (java.lang.String.java.lang.String[])" apilocation: - "sqljdbc.jar" apitype: "Assembly" ms.assetid: 9451c7c2-4c0d-4d1e-9b42-a26ff28e3f6a caps.latest.revision: 13 author: "MightyPen" ms.author: "genemi" manager: "jhubbard" ms.workload: "Inactive" --- # execute Method (java.lang.String, java.lang.String) [!INCLUDE[Driver_JDBC_Download](../../../includes/driver_jdbc_download.md)] Runs the given SQL statement, which can return multiple results, and signals [!INCLUDE[jdbcNoVersion](../../../includes/jdbcnoversion_md.md)] that the auto-generated keys that are indicated in the given array should be made available for retrieval. ## Syntax ``` public final boolean execute(java.lang.String sql, java.lang.String[] columnNames) ``` #### Parameters *sql* A **String** that contains an SQL statement. *columnNames* An array of strings that indicates the column names of the auto-generated keys that should be made available. ## Return Value **true** if the first result is a result set. Otherwise, **false**. ## Exceptions [SQLServerException](../../../connect/jdbc/reference/sqlserverexception-class.md) ## Remarks This execute method is specified by the execute method in the java.sql.Statement interface. ## See Also [execute Method (SQLServerStatement)](../../../connect/jdbc/reference/execute-method-sqlserverstatement.md) [SQLServerStatement Members](../../../connect/jdbc/reference/sqlserverstatement-members.md) [SQLServerStatement Class](../../../connect/jdbc/reference/sqlserverstatement-class.md)