How do I structure the where clause to select columns whose data contains spaces?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am trying to execute this INSERT INTO statement, and it fails when I specify a column that includes a space, such as "L GM", however when the column data contains no spaces as in "LGM" the query executes fine

SELECT TargSrt.opt_symbol AS FirstOfopt_symbol, TargSrt.Ticker, TargSrt.imp_volat AS Hvolat, TargSrt.strike AS FirstOfstrike, TargSrt.exp_date AS FirstOfexp_date INTO Temp From TargSrt WHERE TargSrt.opt_symbol = 'L GM'

the above statement simply doesnt insert anything into the TEMP table, whereas the following statement works fine (exactly same except for where clause)

SELECT TargSrt.opt_symbol AS FirstOfopt_symbol, TargSrt.Ticker, TargSrt.imp_volat AS Hvolat, TargSrt.strike AS FirstOfstrike, TargSrt.exp_date AS FirstOfexp_date INTO Temp From TargSrt WHERE TargSrt.opt_symbol = 'ABCD'

How do I structure the where clause to select columns whose data contains spaces?
 
Your statement is correct. Are you sure there is data that matches this
criteria? There might be stray spaces that is causing it to not match.

Kelvin

Ken said:
I am trying to execute this INSERT INTO statement, and it fails when I
specify a column that includes a space, such as "L GM", however when the
column data contains no spaces as in "LGM" the query executes fine:
SELECT TargSrt.opt_symbol AS FirstOfopt_symbol, TargSrt.Ticker,
TargSrt.imp_volat AS Hvolat, TargSrt.strike AS FirstOfstrike,
TargSrt.exp_date AS FirstOfexp_date INTO Temp From TargSrt WHERE
TargSrt.opt_symbol = 'L GM';
the above statement simply doesnt insert anything into the TEMP table,
whereas the following statement works fine (exactly same except for where
clause):
SELECT TargSrt.opt_symbol AS FirstOfopt_symbol, TargSrt.Ticker,
TargSrt.imp_volat AS Hvolat, TargSrt.strike AS FirstOfstrike,
TargSrt.exp_date AS FirstOfexp_date INTO Temp From TargSrt WHERE
TargSrt.opt_symbol = 'ABCD';
How do I structure the where clause to select columns whose data contains
spaces?
 
Back
Top