Hello everyone, I am trying to INSERT a command in my table but I have a problem. The command has to be exactly like this:
SELECT Value FROM OPENQUERY (iHistorian,'SELECT * FROM ihRawData WHERE TagName LIKE *DEM_S01_N and SamplingMode=CurrentValue')[i]
This command I have to insert into the table name SQLLIB (sqlname, sqlcmd):
INSERT INTO sqllib VALUES ('CMD1', 'SELECT Value FROM OPENQUERY (iHistorian,'SELECT * FROM ihRawData WHERE TagName LIKE *DEM_S01_N and SamplingMode=CurrentValue');')
The problem is is with the quote ' in my command. How can I get my command into the table?
I have tryed with second single quote, but I get an error:
Cannot process the object "'SELECT * FROM ihRawData WHERE TagName LIKE *DEM_S01_N and SamplingMode=CurrentValue'". The OLE DB provider "IhOLEDB.iHistorian" for linked server "iHistorian" indicates that either the object has no columns or the current user does not have permissions on that object.