472,090 Members | 1,304 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,090 software developers and data experts.

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 1940
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
reply views Thread by leo001 | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.