use Research
go

DECLARE @TableName varchar(255);

CREATE TABLE #GetRecordingTempTable([TableName] varchar(255) NOT NULL, [mrs] date);

DECLARE Table_Cursor CURSOR FOR
--包含有列‘sigdate’的表 select a.[name] 表名 from sysobjects a, (   select [id],count(*) b from syscolumns   where [name] ='sigdate'   group by [id] ) b where a.[id]=b.[id] order by name asc OPEN Table_Cursor; FETCH NEXT FROM Table_Cursor INTO @TableName; WHILE(@@FETCH_STATUS=0) BEGIN   EXEC('insert into #GetRecordingTempTable(TableName,mrs) SELECT '''+@TableName+''', max(sigdate) FROM ['+@TableName+'];'); FETCH NEXT FROM Table_Cursor INTO @TableName; END select A.*,B.rk from #GetRecordingTempTable A inner join Research..datelist_tradingdate_daily B on mrs=sigdate order by mrs desc CLOSE Table_Cursor; DEALLOCATE Table_Cursor; DROP TABLE #GetRecordingTempTable; GO

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-02-09
  • 2022-12-23
猜你喜欢
  • 2021-07-17
  • 2022-12-23
  • 2022-01-23
  • 2021-10-05
  • 2021-11-29
  • 2021-09-07
  • 2021-06-15
相关资源
相似解决方案