Question

I am looking for a query to use in PHP that looks something like this:

$sql = "TRUNCATE * Columns EXCEPT ID WHERE ID = '$idvar'";

I realize that this is probably not usable syntax, but if someone knows a query that works like the one I posted above, that would be perfect.

All help is greatly appreciated.

Était-ce utile?

La solution

It seems the best way to reset an MSSQL table row's columns except it's ID, is to use the UPDATE statement, and then SET all of the columns except the ID column to NULL, or a space character.

Here is the query I am going to use:

$sql = "UPDATE table SET col1=' ', col2=' ', col3=' ' WHERE id = '$idvar'";
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top