I have the following code:
SqlConnection connection = new SqlConnection(@"Data Source=MY-PC;Initial Catalog=master;Integrated Security=True");
connection.Open();
using (SqlCommand command = new SqlCommand("CREATE TABLE Table1 (Weight INT, Name TEXT, Breed TEXT)", connection))
{
command.ExecuteNonQuery();
}
connection.Close();
Using this I am able to add a new table called "Table1". But as soon as I change the table name to only numbers, such as using "CREATE TABLE 123456 (Weight INT, Name TEXT, Breed TEXT)"
.
I get
SQLException: Incorrect syntax near '123456'.
How can I create a tablename with only numbers?