Share your ideas for the JMP Scripting Unsession at Discovery Summit by September 17th. We hope to see you there!
Choose Language Hide Translation Bar
Highlighted
jy06115197
Level I

Execute SQL Question

If I have quotation marks for my SQL column names, what should I do when doing Execute SQL:

1.PNG

 

 

2.PNG

 

 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
pmroz
Super User

Re: Execute SQL Question

Use the special escape characters \[ and ]\ to surround your string, then you can have as many double quotes as you want.

sql_statement = 
"\[SELECT TOP 1000 [Test Number]
	,[Test Type]
	,[Ton]
	,[Date]
	,["OD Unit  Model"]
	,["OD Unit  Serial"]
]\";
write(sql_statement);

Here's what shows up in the log window:

SELECT TOP 1000 [Test Number]
	,[Test Type]
	,[Ton]
	,[Date]
	,["OD Unit  Model"]
	,["OD Unit  Serial"]

View solution in original post

1 REPLY 1
Highlighted
pmroz
Super User

Re: Execute SQL Question

Use the special escape characters \[ and ]\ to surround your string, then you can have as many double quotes as you want.

sql_statement = 
"\[SELECT TOP 1000 [Test Number]
	,[Test Type]
	,[Ton]
	,[Date]
	,["OD Unit  Model"]
	,["OD Unit  Serial"]
]\";
write(sql_statement);

Here's what shows up in the log window:

SELECT TOP 1000 [Test Number]
	,[Test Type]
	,[Ton]
	,[Date]
	,["OD Unit  Model"]
	,["OD Unit  Serial"]

View solution in original post

Article Labels

    There are no labels assigned to this post.