Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
MarjanMM
Starting Member
4 Posts |
Posted - 2012-09-27 : 07:37:46
|
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 sqllibVALUES ('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?Best regards |
|
webfred
Master Smack Fu Yak Hacker
8781 Posts |
Posted - 2012-09-27 : 07:50:16
|
Inside single quotes you can escape single quotes by a second single quote.'SELECT Value FROM OPENQUERY (iHistorian,''SELECT * FROM ihRawData WHERE TagName LIKE *DEM_S01_N and SamplingMode=CurrentValue'');' Too old to Rock'n'Roll too young to die. |
|
|
MarjanMM
Starting Member
4 Posts |
Posted - 2012-09-27 : 08:15:26
|
Sorry for the wrong topic name,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. |
|
|
webfred
Master Smack Fu Yak Hacker
8781 Posts |
Posted - 2012-09-27 : 08:40:57
|
Please show the statement that gives the posted error. Too old to Rock'n'Roll too young to die. |
|
|
MarjanMM
Starting Member
4 Posts |
Posted - 2012-09-27 : 08:52:23
|
Sorry, I have made a mistace. Now it is OK.Thank you very much |
|
|
webfred
Master Smack Fu Yak Hacker
8781 Posts |
Posted - 2012-09-27 : 08:53:50
|
fine Too old to Rock'n'Roll too young to die. |
|
|
|
|
|