日期:2014-05-18 浏览次数:20397 次
exec 'SELECT '+@p1+' FROM dbo.'+@table+' WHERE '+@p1+'='+@p2+''
------解决方案--------------------
CREATE PROC p_test as SELECT GETDATE() a go CREATE VIEW v_test AS SELECT * FROM OPENROWSET('SQLOLEDB.1','server=FI6\SQL2008;uid=sa;pwd=123','exec test11.dbo.p_test') go SELECT * FROM V_TEST /* a 2009-09-01 11:08:30.197 */ CREATE FUNCTION FN_TEST() RETURNS TABLE AS RETURN( SELECT * FROM OPENROWSET('SQLOLEDB.1','server=FI6\SQL2008;uid=sa;pwd=123','exec test11.dbo.p_test') ) go SELECT * FROM FN_TEST() /* a 2009-09-01 11:08:30.197 */ 本文来自CSDN博客,转载请标明出处:http://blog.csdn.net/htl258/archive/2009/09/10/4539388.aspx