Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
seeker62
Starting Member
40 Posts |
Posted - 2013-02-08 : 17:07:13
|
select *, test.anything as allfrom testwhere all = 'cant'gives me an error stateing that it can not find the field all. That field is in the select statement. So how can I make this work.when i run select *, test.anything from test data appears under the column all |
|
webfred
Master Smack Fu Yak Hacker
8781 Posts |
Posted - 2013-02-08 : 17:18:05
|
where test.anything = 'cant' Too old to Rock'n'Roll too young to die. |
|
|
James K
Master Smack Fu Yak Hacker
3873 Posts |
Posted - 2013-02-08 : 17:19:43
|
ALL is a keyword - that may be the issue. Try this with the square brackets?select *, test.anything as allfrom testwhere [all] = 'cant' Editing: Strike that. I had missed the alias. Go with what WebFred suggested |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2013-02-08 : 23:26:22
|
quote: Originally posted by seeker62 select *, test.anything as allfrom testwhere all = 'cant'gives me an error stateing that it can not find the field all. That field is in the select statement. So how can I make this work.when i run select *, test.anything from test data appears under the column all
if you want to use aliasit should beselect *from(select *, test.anything as [all]from test)twhere [all] = 'cant' i would suggest using this approach only if anything is a complex expression and dont want to repeat otherwise use Freds suggestion------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
|
|
|
|
|