문제

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