DECLARE @S_SQL NVARCHAR(4000) SET @S_SQL = '' SET @S_SQL = @S_SQL + N'CREATE TABLE dbo.t_ItemsSale_20191106_inmem ( ' SET @S_SQL = @S_SQL + N' [seq] [int] IDENTITY(1,1) NOT NULL, ' SET @S_SQL = @S_SQL + N' [open_dt] [varchar](10) NOT NULL, ' SET @S_SQL = @S_SQL + N' [item_cd] [varchar](10) NOT NULL, ' SET @S_SQL = @S_SQL + N' [sale_dt] [datetime] NOT NULL, ' SET @S_SQL = @S_SQL + N' [ask_price] [int] NOT NULL, ' SET @S_SQL = @S_SQL + N' [bid_price] [int] NOT NULL, ' SET @S_SQL = @S_SQL + N' [sale_price] [int] NOT NULL, ' SET @S_SQL = @S_SQL + N' [change_price] [int] NULL, ' SET @S_SQL = @S_SQL + N' [change_per] [decimal](5, 2) NULL, ' SET @S_SQL = @S_SQL + N' [sale_qty] [int] NOT NULL, ' SET @S_SQL = @S_SQL + N' [total_qty] [int] NULL, ' SET @S_SQL = @S_SQL + N' [sale_amt] [bigint] NULL, ' SET @S_SQL = @S_SQL + N' [total_amt] [bigint] NULL, ' SET @S_SQL = @S_SQL + N' [sale_per] [decimal](5, 2) NULL, ' SET @S_SQL = @S_SQL + N' [is_sign] [int] NULL, ' SET @S_SQL = @S_SQL + N' [input_tp] [tinyint] NULL, ' SET @S_SQL = @S_SQL + N' [prev_total_qty] [int] NOT NULL, ' SET @S_SQL = @S_SQL + N' [cl_price] [int] NOT NULL, ' SET @S_SQL = @S_SQL + N' [prev_per] [decimal](9, 2) NULL, ' SET @S_SQL = @S_SQL + N' [change_per_max] [decimal](5, 2) NULL, ' SET @S_SQL = @S_SQL + N' [reg_dt] [datetime] NULL, ' SET @S_SQL = @S_SQL + N'PRIMARY KEY CLUSTERED ' SET @S_SQL = @S_SQL + N'( ' SET @S_SQL = @S_SQL + N' [seq] DESC ' SET @S_SQL = @S_SQL + N') WITH (MEMORY_OPTIMIZED=ON) ON [PRIMARY] ' SET @S_SQL = @S_SQL + N') ON [PRIMARY] ' EXEC (@S_SQL)