sqlserver如何 select into 动态表明

 

declare @TableName1 varchar(100)
declare @sql1 varchar(max)
set @TableName1='ProjectMonthTrack_'+DATENAME(YYYY,GETDATE())+DATENAME(MM,GETDATE())+DATENAME(DD,GETDATE())
set @sql1='select * into '+@TableName1 +' from ProjectMonthTrack'
exec (@sql1)

 

posted @ 2018-12-27 09:07  桎梏110  阅读(772)  评论(0编辑  收藏  举报
Live2D