ChrisM@Work (8/28/2012)
raghuldrag (8/28/2012)
alter procedure Goals_history...
What version of SQL Server is your database?
OP answered in a PM, he's using SQL Server 2000.
Raghuldrag, please post in the SQL Server 7, 2000 forum section. Posting in the SS2K8 section wastes people's time as the solutions may be different and incompatible with your antique version.
For fast, accurate and documented assistance in answering your questions, please read this article.
Understanding and using APPLY, (I) and (II) Paul White
Hidden RBAR: Triangular Joins / The "Numbers" or "Tally" Table: What it is and how it replaces a loop Jeff Moden