如何将记录更新到数据库
问题描述:
所有亲爱的如何将记录更新到数据库.
我有我没有大的数据库.行
我想添加列,并且想更新某些条件下所有空行记录的添加方式...
不.行数是1800.
在此先感谢
dear all how to update record to database.
i have database in which i have large no. of row
i want to add column and i want to update all empty rows record for some condition how to add it...
no. of row is 1800.
thank in advance
答
尝试以下SQL添加具有默认值的新列:
Try the following SQL to add a new column with a default value:
ALTER TABLE TestTable
ADD NewCol INT NOT NULL DEFAULT(0)
GO
此后,如果需要,您可以针对您的特定条件对表进行UPDATE查询,仅更新此新列,例如:
After this, if needed, you can fire an UPDATE query for the table with your specific condition, updating this new column only, like:
UPDATE TestTable
SET NewCol = Some_Value
WHERE ID=2
--some condition
您可以使用T-SQL命令:
ALTER TABLE [更新 [
You can use T-SQL commands:
ALTER TABLE[^]
UPDATE[^]