davidsalazar01 (7/18/2014)
You guys are all right, this is madness I've created here. I'm trying to avoid blocking since there are rows that will be inserting in table frequently. Can one of provide some examples to avoid blocking but at the same time delete data from this table only keeping 3 months? Set based sounds like a good approach. Thanks all.
declare QualifyingServiceLogID cursor
for select ServiceLogID
from ServiceLog (nolock)
where Created < convert( char(10), dateadd( day, -@KeepDays, getdate() ), 121 )
order by ServiceLogID
Is Created actually a text field? Is it indexed properly? Can we see the schema on ServiceLog?
Never stop learning, even if it hurts. Ego bruises are practically mandatory as you learn unless you've never risked enough to make a mistake.
For better assistance in answering your questions[/url] | Forum Netiquette
For index/tuning help, follow these directions.[/url] |Tally Tables[/url]
Twitter: @AnyWayDBA