declare @sql As varchar(8000) declare @TName As varchar(100) set @TName ='[dbo].[xxx_'+convert(char(8),GetDate(),112)+']' set @sql = 'CREATE TABLE '+@TName+' ([CardNo] varchar(50) COLLATE Chinese_PRC_CI_AS NOT NULL, [Electricity] decimal(18,3) NULL, [State] varchar(50) COLLATE Chinese_PRC_CI_AS NULL, [X] decimal(18,3) NULL, [Y] decimal(18,3) NULL, [Floor] int NULL, [CreateDate] datetime NULL, [UserName] varchar(50) COLLATE Chinese_PRC_CI_AS NULL, [FenceID] varchar(50) COLLATE Chinese_PRC_CI_AS NULL, PRIMARY KEY CLUSTERED ([CardNo]) WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON))' execute(@sql)