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.

有帮助吗?

解决方案

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'";
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top