Answered
Create table overwrites existing table in mssql
In a program we use to update our sites, we use the 'create
table' function of MS SQL to create missing tables in databases.
In the thousands of times we have used this, if a table already exists with the same name of the table in the create table command, MS SQL throws an error.
In fact, MS SQL documentation states that only if you include the optional 'overwrite' command, will an existing table be overwritten.
But today, we used this program on a new host we are trying, and the create table command actually did overwrite an existing table with a new table, deleting all the records in the old table.
I am trying to figure out what settings at the server would allow this.
This is the code we are using:
<CFQUERY NAME="recipe" DATASOURCE="recipe" dbtype="ODBC" username="#ruser#" password="#rPASS#">
Create Table recipecats (
RecipecatID int IDENTITY(1, 1) NOT NULL PRIMARY KEY,
recipecatdescription NVARCHAR(50) NULL)
</cfquery>
In the thousands of times we have used this, if a table already exists with the same name of the table in the create table command, MS SQL throws an error.
In fact, MS SQL documentation states that only if you include the optional 'overwrite' command, will an existing table be overwritten.
But today, we used this program on a new host we are trying, and the create table command actually did overwrite an existing table with a new table, deleting all the records in the old table.
I am trying to figure out what settings at the server would allow this.
This is the code we are using:
<CFQUERY NAME="recipe" DATASOURCE="recipe" dbtype="ODBC" username="#ruser#" password="#rPASS#">
Create Table recipecats (
RecipecatID int IDENTITY(1, 1) NOT NULL PRIMARY KEY,
recipecatdescription NVARCHAR(50) NULL)
</cfquery>