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.

Was it helpful?

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'";
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top