By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,378 Members | 1,455 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,378 IT Pros & Developers. It's quick & easy.

reference column name

100+
P: 144
hi,

how to reference an alias column name that consists more than one word.

it's like this

select address, substring(address, 5, 8) as 'member's address' from msmember
where charindex('r', substring( alias column name, 1, 6))>0

i want to check if the first 6 chars of 'member's address' contains 'r'.


thx.
Apr 5 '08 #1
Share this Question
Share on Google+
1 Reply


ck9663
Expert 2.5K+
P: 2,878
hi,

how to reference an alias column name that consists more than one word.

it's like this

select address, substring(address, 5, 8) as 'member's address' from msmember
where charindex('r', substring( alias column name, 1, 6))>0

i want to check if the first 6 chars of 'member's address' contains 'r'.


thx.

I don't think you're allowed to have quote in a column alias.

Try this instead:

Expand|Select|Wrap|Line Numbers
  1. select address, substring(address,5,8) as [member address] from msmember where charindex('r', left(address,6)) > 0
  2.  
Watch out for space on the left side of the address field.

-- CK
Apr 5 '08 #2

Post your reply

Sign in to post your reply or Sign up for a free account.