I'm struggling to get this statement run
SET @SelectStatement = 'INSERT INTO [ArchiveProcessHistory] VALUES (' + @TableName + ',' + @TotalRowsSource +',' + @TotalRowsDestination + ',' + GetDate()') '
[I know something is wrong with the above statment, which I'm not able to fix)
SET @FullStatement = @SelectStatement
ArchiveProcessHistory Table Structure is:
TableName - nvarch(5)
TotalRowsSource - integer
TotalRowsDestination - integer
DateofInsert - Date
It's giving me this error when i run through sp_executesql
Msg 102, Level 15, State 1, Procedure usp_ArchiveTable, Line 39 Incorrect syntax near ') '.
How can I solve this?