Topic: Sectioning and variable in request
SQL 2008 r2. There is big partitioned on quarters (field DDATE) a table fcStock without indexes
If to write request deleting the last 10 days for example
delete from fcStock where ddate> ' 20171002 ' all is processed for seconds and there is a reversal to the necessary section
If beforehand to declare a variable:
DECLARE @DT DATETIME
SET @DT = CONVERT (VARCHAR (8), GETDATE ()-10, 112)
delete from fcStock where ddate>@DT handling goes some minutes and there is a scanning of all table.
In what here there can be a dirty trick?