After many years of trying to work SQLServer into my daily life, I've finally got a project that I can use it. Of course, I still need to attach back to the Informix database where most of my data resides. The following code snippet allows SQLServer to pass a preformatted query through to Informix as a Linked Server.
/****** Object: StoredProcedure [dbo].[ExecOpenQuery] Script Date: 09/11/2007 08:47:54 ******/
SET ANSI_NULLS ON
SET QUOTED_IDENTIFIER ON
ALTER PROCEDURE [dbo].[ExecOpenQuery] (
SET NOCOUNT ON
-- Build OpenQuery command
DECLARE @OpenQuery varchar(4000)
SET @OpenQuery = 'SELECT * FROM OPENQUERY(IfxVisops, '''
-- Display Dynamic SQL
print @OpenQuery + @TSQL
-- Execute SQL
exec(@OpenQuery + @TSQL)