--ImplusDb数据库
use [ImplusDb]
go
declare @name varchar(50);
declare @STMT nvarchar(max) -- SQL to execute
declare cur_data SCROLL cursor for
select distinct(name) from sysobjects where xtype='U' and name like 'ChatHistory%' and name <> 'ChatHistoryManage';
open cur_data
fetch next from cur_data into @name
while(@@fetch_status=0)
begin
SET @STMT = 'alter table '+@name+' add UserToken varchar(50) not null default ('''');'
EXEC (@STMT)
fetch next from cur_data into @name
end;
close cur_data
DEALLOCATE cur_data