<div class="meta" robots="noindex">

</div>

Method

# Database_Class.SQLExecute

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

<div class="warning">

<div class="title">

Warning

</div>

This item was deprecated in version 2019r2. Please use `Database.ExecuteSQL<database.executesql>` as a replacement.

</div>

## Description

Used to execute an SQL command. Use this for commands that do not return any data, such as CREATE TABLE or INSERT. *ExecuteString* contains the SQL statement.

## Notes

To avoid `SQL Injection</topics/databases/protecting_your_database_from_attack>`, be sure to use `Prepared SQL Statements</api/databases/preparedsqlstatement>` or `Database.ExecuteSQL<database.executesql>`.

## Sample code

This code creates the *Team* table:

``` xojo
' App.DB is a SQLite database
Dim sql As String
sql = "CREATE TABLE Team (ID INTEGER NOT NULL, Name TEXT, Coach TEXT, City TEXT, PRIMARY KEY(ID));"

App.DB.SQLExecute(sql)

If App.DB.Error Then
  MsgBox("DB Error: " + App.DB.ErrorMessage)
Else
  MsgBox("Team table created successfully.")
End If
```

## Compatibility

All project types on all supported operating systems.
