Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 table update

Author  Topic 

lane0618
Posting Yak Master

134 Posts

Posted - 2002-06-20 : 18:08:08
I have a table that I want to change all the null values to "0". Is it possible to do this without specifying every column in the update query? I want to run this query frequently, and their will be new columns each time.

Thanks,
Lane

Merkin
Funky Drop Bear Fearing SQL Dude!

4970 Posts

Posted - 2002-06-20 : 19:45:39
Hi

There is a away to do this. But it involves using the system tables to generate a dynamic sql statement that you can execute. It's messy and not good practice.

I can show you if you like but I think you would be best off re-evaluating your database design. Having new columns added all the time is the sign of a database that could do with some optimising.

I think it might be better for you to get to the root of your problem. Of course sometimes we do need ugly hacks

So, what do you think ? If there is a design problem we can help with, lets sort that out. Otherwise I will show you the code to do this.

Damian
Go to Top of Page
   

- Advertisement -