If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > DB2 > get data from column with space

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 08-04-08, 08:45
EetieD EetieD is offline
Registered User
 
Join Date: Aug 2008
Posts: 2
get data from column with space

Hello all,

I was wondering how to get the data from a column when the column has a space. The column name is 'currency -'. Unfortunately I cannot get the data of this column. I already used single and double spaces, but that is also not the solution. Maybe somebody can help? Thanks.
Reply With Quote
  #2 (permalink)  
Old 08-04-08, 09:37
umayer umayer is offline
Registered User
 
Join Date: Dec 2005
Posts: 273
Put the column name in double quote.

SELECT "currency -" FROM your-table


keep in mind, that the column-name is case sensitiv if you use double quotes.

SELECT "currency -" FROM your-table

is not the same as

SELECT "Currency -" FROM your-table

Last edited by umayer; 08-04-08 at 09:43.
Reply With Quote
  #3 (permalink)  
Old 08-04-08, 16:24
tonkuma tonkuma is offline
Registered User
 
Join Date: Feb 2008
Location: Japan
Posts: 2,193
If you want to select "the data from a column when the column has a space",
use:
WHERE "currency -" LIKE '% %'
or
SELECT CASE WHEN "currency -" LIKE '% %' THEN "currency -" ELSE ... END

and note what umayer said:
Quote:
keep in mind, that the column-name is case sensitiv if you use double quotes.

SELECT "currency -" FROM your-table

is not the same as

SELECT "Currency -" FROM your-table
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On