![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
I have many tables and in those i require to change some data. Say from ARCA to ARCAEX. I am sure that the string is unique in the sense there will be no ARCAABC. So what do i do change by not manually needing to search in each table and the whole database and still can be sure that the changes have taken place. Please help Regards, Rajesh |
#3
| |||
| |||
|
|
If that, what I think you problem is, is true, then i think you can try the next: Make a cursor loop trough the tables in de sysobjects and make in every loop a text string that contains a update statement for the current table and execute that string. That works only when every table has the same column names ofcourse... For SQL Server 2000 something like: DECLARE @Table_name sysname DECLARE @cmd1 varchar(1000) DECLARE c_table CURSOR FOR SELECT [Name], FROM sysobjects WHERE [Name] LIKE ('ARC%') ORDER BY [Name] OPEN c_table FETCH NEXT FROM c_table INTO @Table_name WHILE(@@FETCH_STATUS <> -1) BEGIN SELECT @cmd1 = 'UPDATE ' + @Table_name + ' SET columnname = ''value''' EXEC (@cmd1) FETCH NEXT FROM c_table INTO @Table_name END CLOSE c_table DEALLOCATE c_table raj_chins (AT) rediffmail (DOT) com (Rajesh Garg) wrote in message news:<14215add.0308042113.10c410e5 (AT) posting (DOT) google.com>... I have many tables and in those i require to change some data. Say from ARCA to ARCAEX. I am sure that the string is unique in the sense there will be no ARCAABC. So what do i do change by not manually needing to search in each table and the whole database and still can be sure that the changes have taken place. Please help Regards, Rajesh |
![]() |
| Thread Tools | |
| Display Modes | |
| |