Single quotes in select predicates

rmm

ADSM.ORG Member
Joined
Jan 13, 2005
Messages
2
Reaction score
0
Points
0
I am unable to find a way to escape a single quote inside a select statement. For example, the following works perfectly:

dsmadmc -id=admin -password={pw} "select VOLUME_NAME from DRMEDIA where STATE='NOTMOUNTABLE' and location='Joes Desk'"

However, I can't find a way to perform the select with an apostrophe inside "Joe's Desk". I have tried the following without success:

dsmadmc -id=admin -password={pw} "select VOLUME_NAME from DRMEDIA where STATE='NOTMOUNTABLE' and location='Joe\'s Desk'"

dsmadmc -id=admin -password={pw} "select VOLUME_NAME from DRMEDIA where STATE='NOTMOUNTABLE' and location='Joe''s Desk'"

dsmadmc -id=admin -password={pw} "select VOLUME_NAME from DRMEDIA where STATE='NOTMOUNTABLE' and location=\"Joe's Desk\""

... and others, without success. I've got to be missing something simple and/or obvious, but I'm stumped. The q drmedia command handles the apostrophe just fine, but the requirement (as far as I can tell) that the right hand side of the select where predicate be single-quoted is the source of the problem. I realize I can work around this in a number of ways (don't use apostrophies, use q drm instead of select, etc)... however, I'd really like to make the select work.

Any help would be MUCH appreciated!

-- Rob
 
I maybe wrong but select statements for TSM may not handle escape characters as the database is a lite version.

Again, I maybe wrong.
 
if you want to make the select statement work, you can use like %'Joe'% as a workaround.
 
moon-buddy: i would say you are right... it sure looks like the "lite" includes not handling any kind of escape characters.

umur: excellent suggestion! The current workaround I have replaces the ticks with an underscore and uses like... e.g. location like 'Joe_s Desk'

Thank you both very much for your input!!!

-- Rob
 
Depending on your shell, you may need "Joe\\\'s Desk", because the shell sees the escape and removes it before passing it to dsmadmc.
 
Back
Top