RSS Links

 

Here are all of the RSS links for sections of this site

VB.NET/ASP.NET
 Java
 Unix/Linux
 Windows
 SQL Server

Home arrow SQL Server arrow How can I update a column value in all tables in SQL Server
How can I update a column value in all tables in SQL Server PDF Print E-mail
Wednesday, 31 December 2008

This query will write out a SQL Query, which will Update a Column Value in All Tables
First, open SQL Server and select SQL Server Query Analyzer from the Tools menu. Type the following SQL statement in the query analyzer window (Type='U' specifies user-defined tables):

SELECT 'UPDATE ',RTRIM(Name),' SET UserID=2 WHERE UserID=1' FROM sysobjects WHERE Type='U'

Run the SQL statement. Then copy the results from the result window, paste them in the query window, and run them. Thanks to Venkat Alladi (devx.com) for this great timesaver - http://www.devx.com/tips/Tip/14129

 
< Prev   Next >
 
Designed by Graham Robinson Software