I have a database where several thousand records have NULL in a binary field. I want to change all the NULLs to false. I have Visual Studio 5, and the database is a SQL Server 5 database on a remote server. What is the easiest way to do this? Is there a query I can run that will set all ReNew to false where ReNew is Null? This is a live database so I want to get it right. I can't afford to mess it up.
Diane
You can do something like the following:
UPDATE [Table] SET ReNew=0 WHERE ReNew IS NULL
Before I run an update or delete statement, I always run it as a select first, just to make sure I'm only updating the rows I want. Something like this:
SELECT * FROM [Table] WHERE ReNew IS NULL
|||
Benners_J:
Before I run an update or delete statement, I always run it as a select first, just to make sure I'm only updating the rows I want. Something like this:
SELECT * FROM [Table] WHERE ReNew IS NULL
Rather, SELECT COUNT(*) FROM [Table] WHERE ReNew IS NULL would be good, since the poster is saying there are too many rows. Anything which makes you feel comfortable.
No comments:
Post a Comment