How to Set a variable using OPENQUERY in SQL Server
问题 I am trying to read data from a table. This table have a list of table name. for each row of the data set I want to run a couple of queries to pull data and insert it into a temporary table. Here is What I have done DECLARE @campName varchar(255); DECLARE @sqlCommand varchar(1000); DECLARE @sqlCommandMySQL varchar(1000); DECLARE @LastRun varchar(60); DECLARE @OPENQUERY varchar(1000); DECLARE MY_CURSOR CURSOR LOCAL STATIC READ_ONLY FORWARD_ONLY FOR SELECT LTRIM(RTRIM(CallListName)) AS