February 18, 2011 at 8:25 am
The Server Name column that is returned with multiserver queries (if the option is set to True), can it be referenced in a GROUP BY or HAVING clause? I have been able to somewhat work around it by using @@servername and doing a join on sys.servers. But I would prefer to use less code, if it is possible.
February 18, 2011 at 9:00 am
Is it a named column in the query? If so, try grouping by it in a proof of concept query.
- Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
Property of The Thread
"Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon
February 18, 2011 at 9:25 am
No, it is added to the results if you go to OPTIONS->Query Results->Multiserver Results-> and make Add server name to the results TRUE.
February 21, 2011 at 8:33 am
Can you insert those results in a temp table and then query that?
- Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
Property of The Thread
"Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon
February 22, 2011 at 1:35 pm
Nope...the [Server Name] column appears to be appended by the IDE, not on the server-side.
There are no special teachers of virtue, because virtue is taught by the whole community.
--Plato
February 23, 2011 at 6:05 am
Can you explicitly add @@servername to the query and use that?
- Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
Property of The Thread
"Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon
February 24, 2011 at 5:19 pm
Yes, that is what I am doing. I was just hoping that I would be able to use the supplied column. Thanks.
February 25, 2011 at 6:59 am
I think @@servername is what you're stuck with.
- Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
Property of The Thread
"Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon
Viewing 8 posts - 1 through 7 (of 7 total)
You must be logged in to reply to this topic. Login to reply