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.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 'select as' aliasing problem

Author  Topic 

zbigniew
Starting Member

3 Posts

Posted - 2004-04-29 : 05:45:49
hey,

let's say i have table b with column a, i'm trying to select that column with a different name, say 'foo'. so i do:
select b.a as foo from b;

in return i get column 'a' instead of column 'foo'. select a as foo from b does work, but that won't work in my case since i'm doing some complicated queries.

how can i achieve what i want?

best regards!

ditch
Master Smack Fu Yak Hacker

1466 Posts

Posted - 2004-04-29 : 05:51:47
I don't have that problem:

create table #b(a int)

insert into #b values(1);
insert into #b values(2);
insert into #b values(3);
insert into #b values(4);
insert into #b values(5);


select #b.a as foo
from #b

Returns
foo
1
2
3
4
5

Perhaps you are using a technology other than SQL server.



Duane.
Go to Top of Page

zbigniew
Starting Member

3 Posts

Posted - 2004-04-29 : 06:39:30
it is sql server 2000.

i didn't mention i'm accessing it via the jtds jdbc driver (http://jtds.sf.net)

trying the microsoft jdbc driver, perhaps it will work then.
Go to Top of Page

RickD
Slow But Sure Yak Herding Master

3608 Posts

Posted - 2004-04-29 : 07:05:08
Sounds like driver translation then...
Go to Top of Page

zbigniew
Starting Member

3 Posts

Posted - 2004-04-29 : 07:09:46
that was it. works fine with the MS jdbc driver.
Go to Top of Page
   

- Advertisement -