Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 'select * from o2o.dbo.sth'
- use hxo2o
- go
- begin
- declare @last_sync_date_updater nvarchar(2000)
- declare @tb_name nvarchar(200)
- declare tb_name_cur cursor for
- select table_name from dbo.o2o_tables
- open tb_name_cur
- fetch next from tb_name_cur into @tb_name
- while @@fetch_status = 0
- begin
- set @last_sync_date_updater =
- 'update dbo.o2o_tables set table_last_sync_date = (select '
- + case
- when @tb_name = 'trace_user_actions' then 'max(operation_date_time)'
- else ' dbo.InlineMax(max(create_time), max(update_time)) ' end
- + 'from dbo.' + @tb_name + ')'
- exec (@last_sync_date_updater)
- fetch next from tb_name_cur into
- @tb_name
- end
- close tb_name_cur
- deallocate tb_name_cur
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement