OpenQuery

@part = 'select top 1 * from ntp.dbo.penhold 
where convert(varchar, request_date, 111) = ntp.dbo.fn_getpreweekday(''' + @ldate + ''')'

sp_execute_sql('select @var = count(1) from openquery(linkserver, ''' + @part + ''')')



你可能感兴趣的:(query)