declare cursor1 cursor for select name from sysobjects where xtype='u' and name like '%12' declare @i varchar(1000) open cursor1 fetch cursor1 into @i while @@fetch_status=0 begin exec('ALTER TABLE table '+@i+' COLLATE chinese_prc_CS_Ai') fetch cursor1 into @i end close cursor1 deallocate cursor1
asc//升序,默认 desc//降序 select * from 表 order by asc 字段名 select * from 表 order by desc 字段名
declare
@i varchar(1000)
open cursor1
fetch cursor1 into @i
while @@fetch_status=0
begin
exec('ALTER TABLE table '+@i+' COLLATE chinese_prc_CS_Ai')
fetch cursor1 into @i
end
close cursor1
deallocate cursor1
desc//降序
select * from 表 order by asc 字段名
select * from 表 order by desc 字段名