Assigning a @@ROWCOUNT to a variable
I have a DTS package that creates 7 textfiles from a table (on a weekly basis).
What I want to do, as each textfile is created is to assign the recordcount to a variable and then use the 7 variables (at the end of the package) to log the changes historically, by a date in another table.
This is the code I have
DECLARE @Total1 int
SET @Total1 = @@ROWCOUNT
--and then at the last step of the package
INSERT INTO logTable (Total1 , Total2 , Total3, ...)
VALUES (@Total1, @Total2, @Total3, ...)
--The error message I get is this
Error 'Must declare the variable Total1, Total2, ...'
How and where do I assign a variable within a DTS package, I have looked at the 'Set Global Variable' Object, but I am unsure