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 |
|
Sarakumar
Posting Yak Master
108 Posts |
Posted - 2006-08-01 : 04:28:20
|
| Hai friends, i have got a doubt. For two Columns i need to have same column name. Is it possible? select sname as [name],candidate as [name],sid from tbl |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2006-08-01 : 04:32:40
|
Yes it is allow.Example :use Northwindselect CompanyName as [name], ContactName as [name]from Customers But why do you want to do this ? KH |
 |
|
|
Sarakumar
Posting Yak Master
108 Posts |
Posted - 2006-08-01 : 04:44:46
|
quote: Originally posted by khtan Yes it is allow.Example :use Northwindselect CompanyName as [name], ContactName as [name]from Customers But why do you want to do this ? KH
i wounder, but if i try u query is working. but in my requirement im applying this logic for case statmet case when sname like 'r%' then true else false end as [sname],case when sname like 'm%' then true else false end as [sname],but i get the output as sname,sname1...that's y i asked..any idea??? |
 |
|
|
Sarakumar
Posting Yak Master
108 Posts |
Posted - 2006-08-01 : 04:48:48
|
| Sorry, i think it is the problem in the front end...sorry for the trouble |
 |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2006-08-01 : 04:50:17
|
do you get this when running in Query Analyser ? KH |
 |
|
|
AndrewMurphy
Master Smack Fu Yak Hacker
2916 Posts |
Posted - 2006-08-01 : 05:48:17
|
| Would you not be better off with select sname as [name], sid from tblunionselect candidate as [name], sid from tblWhat you are trying to do is not-advised...and given you are running into problems...difficult to work with |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2006-08-01 : 11:15:22
|
| Butcase when sname like 'r%' then true else false end as [sname],case when sname like 'm%' then true else false end as [sname],can be rewritten ascase when (sname like 'r%' or sname like 'm%') then true else false end as [sname]MadhivananFailing to plan is Planning to fail |
 |
|
|
|
|
|
|
|