Thanks to Szalmmany and Techgnome I was cruising along with SPROCS on my MS SQL2005 DB but when I went to work today tragedy struck. The SPROCS that I spend a weekend creating will no t run on our MS SQL 7.0 box specifically 7.0 doesn't like this line:
VB Code:
DECLARE @ListTbl TABLE(InvUnit varchar(100)
I am getting the following error:

Originally Posted by
Query Analyzer
Incorrect syntax near the Keyword 'Table'
Here is a copy of the SPROC:
VB Code:
USE IADATA
IF EXISTS (select * from syscomments where id = object_id ('TestSP'))
DROP PROCEDURE TestSP
GO
CREATE PROCEDURE TestSP
/*Declare Variables*/
@ListStr varchar(100) /*Hold Delimited String*/
AS
DECLARE @ListTbl Table (InvUnit varchar(50)) /*Creates Temp Table*/
DECLARE @CP int /*Len of String */
DECLARE @SV varchar(50) /*Holds Result */
While @ListStr<>''
Begin
Set @CP=CharIndex(',',@ListStr) /*Sets length of words - Instr */
If @CP<>0
Begin
Set @SV=Cast(Left(@ListStr,@CP-1) as varchar) /*Copies Portion of String*/
Set @ListStr=Right(@ListStr,Len(@ListStr)-@CP) /*Sets up next portion of string*/
End
Else
Begin
Set @SV=Cast(@ListStr as varchar)
Set @ListStr=''
End
Insert into @ListTbl Values (@SV) /*Inserts variable into Temp Table*/
End
Select InvUnit From @ListTbl LT
INNER Join dbo.Incidents ST on ST.Inv_Unit=LT.InvUnit
Here is a link to the post
BTW, this SP runs fne on a MS SQL2005 box. Any Ideas?