I have a mssql 2005 database with a linked server to a FoxPro9 database. As you can see below I just want to dynamically construct an openquery.
Please help or direct me.
Thanx
Fetch Next from OOS into @OrderDate, @Company, @DrugCode, @Message, @QtySupplied, @QtyOrdered
While @@Fetch_Status = 0
Begin
if @qtysupplied = @qtyordered
select * from openquery([fred], 'delete from drugnote where dntcode="' + @DrugCode + '"')
else
set @OOSMessage = @Message + ' from ' + @Company + ' on ' + @OrderDate
select * from openquery([fred], 'update drugnote set dntnote="{\rtf1\ansi\ansicpg1252\deff0\deflang3081{\fonttbl{\f0\fnil\fcharset0 Arial;}} \viewkind4\uc1\pard\b\' + @OOSMessage + ' \b0\fs20 \par }" where dntcode="' + @DrugCode + '"')
end
Fetch Next from OOS into @OrderDate, @Company, @DrugCode, @Message, @QtySupplied, @QtyOrdered
END
Close OOS
Deallocate OOS
Please help or direct me.
Thanx
Fetch Next from OOS into @OrderDate, @Company, @DrugCode, @Message, @QtySupplied, @QtyOrdered
While @@Fetch_Status = 0
Begin
if @qtysupplied = @qtyordered
select * from openquery([fred], 'delete from drugnote where dntcode="' + @DrugCode + '"')
else
set @OOSMessage = @Message + ' from ' + @Company + ' on ' + @OrderDate
select * from openquery([fred], 'update drugnote set dntnote="{\rtf1\ansi\ansicpg1252\deff0\deflang3081{\fonttbl{\f0\fnil\fcharset0 Arial;}} \viewkind4\uc1\pard\b\' + @OOSMessage + ' \b0\fs20 \par }" where dntcode="' + @DrugCode + '"')
end
Fetch Next from OOS into @OrderDate, @Company, @DrugCode, @Message, @QtySupplied, @QtyOrdered
END
Close OOS
Deallocate OOS