I have this parameters in SQL Server:
SET DATEFORMAT DMY
DECLARE @FECHA_ACT VARCHAR(10)
DECLARE @PERIODO char(6)
SET @FECHA_ACT = CONVERT(CHAR(10),GETDATE(),112)
SET @PERIODO=cast(CONVERT(CHAR(6),GETDATE(),112) as int)
I want to create a table using :
TEMPDB..#abc_def_['+@FECHA_ACT+']
but I am getting this error when I tried to create the table:
> Database name 'TEMPDB' ignored, referencing object in tempdb.
> Msg 102, Level 15, State 1, Line 15
> Incorrect syntax near ''+@FECHA_ACT+''.
> Database name 'TEMPDB' ignored, referencing object in tempdb.
> Msg 102, Level 15, State 1, Line 19
> Incorrect syntax near ''+@FECHA_ACT+'''.
> Msg 102, Level 15, State 1, Line 32
> Incorrect syntax near 'B'.