日期:2014-05-19  浏览次数:20470 次

请问下列怎样传送参数呢?谢谢
declare   @ipaddress   char(30)
set   @ipaddress= '127.0.0.1 '
select     *   into   A   from   OPENDATASOURCE(
                  'SQLOLEDB ',
                  'Data   Source=127.0.0.1;User   ID=sa;Password=sa '
                  ).SERVERDB.dbo.MFG   where   dbo.MFG.DATETIMES   > = '2007-3-9 '

请问如何用@ipaddress,去做data   source的参数呢?
thanks

------解决方案--------------------
declare @ipaddress char(30)
set @ipaddress= '127.0.0.1 '
declare @s varchar(8000)
set @s= 'select * into A from OPENDATASOURCE(
' 'SQLOLEDB ' ',
' 'Data Source= ' ' '+@ipaddress+ ';User ID=sa;Password=sa ' '
).SERVERDB.dbo.MFG where dbo.MFG.DATETIMES > = ' '2007-3-9 ' ' '