1: declare @fetchStatus as int; set @fetchStatus = 0
2: declare @str as varchar(100), @views as varchar(100)
3: declare tmp cursor for
4:
5: select [name] from sys.views
6:
7: open tmp
8:
9: while @fetchStatus = 0 begin
10: fetch tmp into @views
11: set @fetchStatus = @@fetch_status
12: if @fetchStatus = 0 begin
13: print @views
14: set @str = 'select * from ' + @views + ' where 0 = 1'
15: exec (@str)
16: end
17: end
18:
19: close tmp
20: deallocate tmp
No comments:
Post a Comment