Thank you for the update.I have now defined a linked server on SQL Server 2005 that points to SQL Server 2000. Using the SQL Query Analyser I am trying to call my sp on 2005 which in return should call the sp on 2000.My call:declare @Sql nvarchar(500) declare @JobNumber int declare @Parm as nvarchar(100)set @Sql = 'sp_Vecellio_ProductionQtyCompare'set @JobNumber = 1100281set @Parm = @JobNumberexec sp_executesql @Sql, @Parm
Error:Msg 102, Level 15, State 1, Line 1Incorrect syntax near '1100281'.My sp on 2005:CREATE PROCEDURE sp_Vecellio_ProductionQtyCompare @JobNumber intasexec [VGIWPW03-SQL3\EQUENTIALPROD].goLabor30.dbo.sp_Vecellio_ProductionInquiry @JobNumber GO
My sp on 2000:CREATE PROCEDURE sp_Vecellio_ProductionInquiry @JobNumber intasSELECT distinct(dbo.Item.CompanyItemId), substring(dbo.Item.Name, 1, 15) as description, case dbo.SourceType.CompanySourceTypeId when 'PR' then SUM(dbo.ProductionEvent.Quantity) end AS Ttl_Qty FROM dbo.Batch INNER JOIN dbo.Event ON dbo.Batch.BatchGuid = dbo.Event.BatchGuid INNER JOIN dbo.Job ON dbo.Event.JobGuid = dbo.Job.JobGuid INNER JOIN dbo.ProductionEvent ON dbo.Event.EventGuid = dbo.ProductionEvent.EventGuid INNER JOIN dbo.Item ON dbo.Event.ItemGuid = dbo.Item.ItemGuid INNER JOIN dbo.Source ON dbo.ProductionEvent.SourceGuid = dbo.Source.SourceGuid INNER JOIN dbo.SourceType ON dbo.Source.SourceTypeGuid = dbo.SourceType.SourceTypeGuid LEFT OUTER JOIN dbo.Product ON dbo.ProductionEvent.ProductGuid = dbo.Product.ProductGuid left outer join dbo.JobNoteEvent on Event.EventGuid = dbo.JobNoteEvent.EventGuidWHERE dbo.job.CompanyJobId = @JobNumber and dbo.SourceType.CompanySourceTypeId = 'PR'GROUP BY dbo.Item.CompanyItemId, dbo.SourceType.CompanySourceTypeId, dbo.Item.NameGO