I think you need your @COuntSQLQUery to be this: "Select @recordcount = count(*) from dbo.table1"
The question now becomes, why are you using dynamic sql for this?
Jack Corbett
Consultant - Straight Path Solutions
Check out these links on how to get faster and more accurate answers:
Forum Etiquette: How to post data/code on a forum to get the best help
Need an Answer? Actually, No ... You Need a Question