469,930 Members | 1,685 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,930 developers. It's quick & easy.

reference column name

144 100+
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
1 1877
ck9663
2,878 Expert 2GB
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.

Similar topics

7 posts views Thread by Wolfgang Kreuzer | last post: by
reply views Thread by MrMike | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.