We have a linked server and its fetching employee records to our database
There is a stored procedure and this is the select statement inside that stored procedure
SQL
select@x='select * from openquery(UPS ,''select * from openquery([MCSDB10\MGMTDB10],''''select [EMPID] ,[NameAr] ,[NameEn] ,[Gender] ,[CivilID] ,[Mobile] ,[Email] from [UPS].dbo.[View_EMPID_AB1700] WHERE LastDateUpdate = '''''''''+@TaskLastRun+''''''''' '''')'')'SETNOCOUNTon;exec(@x);
SQL
select@x='select * from openquery(UPS ,''select * from openquery([MCSDB10\MGMTDB10],''''select[EMPID]
SQL
WHERELastDateUpdate=''''''''' + @TaskLastRun + ''''''''''''')'')'