hi need to test info from a table to see if my query is wqorking right. trying to test a bit of a time. trying the below code first but keep getting Must declare the table variable "@WorkingNamingTable".i have declared it so not sure why it wont work. any ideas anyone-- Declare varibles DECLARE@SQLStmt NVARCHAR(MAX),@FieldName NVARCHAR(50),@StringReplacement NVARCHAR(200),@StringToFind NVARCHAR(200),@maxPK INT,@pk INT,@Quote NVARCHAR(1),@WorkingNamingTable NVARCHAR(256),@WorkingDataloadFile2 NVARCHAR(256) --@WorkingNamingTable = 'WorkingNamingTable'--SELECT @WorkingDataloadFile2 = 'WorkingDataloadFile2'SELECT @FieldName = Field from @WorkingNamingTable WHERE PK_ID = (Select PK_ID From #StringReplace Where PK_ID = @pk)