DECLARE @ID nvarchar(50)
DECLARE @Name nvarchar(50)
DECLARE @ID2 nvarchar(50)
DECLARE @Name2 nvarchar(50)
DECLARE @ID3 nvarchar(50)

DECLARE my_cursor CURSOR FOR select name,object_id from sys.tables where type='U'
Open my_cursor
fetch my_cursor into @Name,@ID
while @@fetch_status=0
begin
 --SELECT @Name,@ID
   
    DECLARE my_cursor2 CURSOR FOR  select name,object_id,column_id from sys.columns where object_id=@ID
    Open my_cursor2
 fetch my_cursor2 into @Name2,@ID2,@ID3
 while @@fetch_status=0
 begin
  --select @ID2,@Name2
  declare @cnt int
  select @cnt=COUNT(*) from sys.extended_properties where major_id=@ID and minor_id=@ID3 and
  name='MS_Description'
  if(@cnt>0)
  begin
  EXEC sp_dropextendedproperty 
  @name = 'MS_Description' 
     ,@level0type = 'schema' 
  ,@level0name = dbo
  ,@level1type = 'table'
  ,@level1name = @Name
  ,@level2type = 'column'
  ,@level2name =@Name2;
  print '表['+@Name+']字段['+@Name2+']说明清除成功!'
  end
  fetch my_cursor2 into @Name2,@ID2,@ID3
 end
 close my_cursor2
 deallocate my_cursor2
 fetch my_cursor into @Name,@ID
end
close my_cursor
deallocate my_cursor

 

相关文章:

  • 2022-01-07
  • 2021-12-28
  • 2021-09-02
  • 2022-12-23
  • 2021-05-26
  • 2021-07-10
  • 2022-12-23
  • 2022-01-20
猜你喜欢
  • 2021-11-18
  • 2022-12-23
  • 2021-06-22
  • 2022-12-23
  • 2022-12-23
  • 2021-10-07
  • 2021-12-30
相关资源
相似解决方案