Viewing 15 posts - 1 through 15 (of 16 total)
this
RN = 11 - ROW_NUMBER() OVER(PARTITION BY HostIp ORDER BY CreateDate DESC)
creates a ranked list based on the ip
then, all you needed to do is pivot the table!!
GREAT!!
THANKS 😉
November 2, 2010 at 8:48 am
GREAT!!!! 😀
I knew it was a matter of pivoting...but couldn't figure out how to deal with the dates...
do you mind to give an explanation? I think i sort of understood...
November 2, 2010 at 8:44 am
Well..i know how recursive CTEs work 😀
i am interested in the select on the rCTE.
Anyway... now it works on the real problem as well 😉
October 18, 2010 at 4:47 am
and it's going to take me quite some time to adapt it to real tables and rules (as i mentioned, i proposed here a simplified version) but this is something...
October 18, 2010 at 4:22 am
I think this is not a problem that can be solved with a set based programming language. Gianluca, your solution doesn't work. Returns the correct values for 1.1.1.1 but fails...
October 18, 2010 at 3:10 am
Well... go on then 😉 i'm working on a solution as well 🙂
hey wait... i still have to test your last solution 😛
October 14, 2010 at 10:06 am
i think i'm going back to cursors.
do you have any idea why my first solution returns a null?
October 14, 2010 at 9:26 am
hallidayd (10/14/2010)
That will be due to the dbo.Test, whatever that is.
Test is the function
October 14, 2010 at 8:24 am
mind that:
there might be more than 2 occurrences
there might be more that 2 iteration
i.e.
1.1.1.1 ...
October 14, 2010 at 8:22 am
This function
BEGIN
--declare @tmpresult nvarchar(50)
declare @result nvarchar(50)
if...
October 14, 2010 at 8:07 am
Sorry guys... can't get the hang of it.
hallidayd i get an error, can you explain me how your snippet works? AFAIK coalesce need more than just one argument
I'm now giving...
October 14, 2010 at 7:21 am
hallidayd (10/14/2010) you have come to the conclusion the best solution uses a cursor, but it doesn't
I see!! 😉
Thanks, i'll do some test with the posted code! 🙂
October 14, 2010 at 5:31 am
Uhmm...not sure i made myself clear 🙂
Anyway: this is a simplified version of the working UDF
create function [dbo].[alias2dnsname]
(
@alias nvarchar(50)
)
returns nvarchar(50)
as
BEGIN
declare @tmpresult nvarchar(50)
declare @result nvarchar(50)
if exists(select * from dnszone as D...
October 14, 2010 at 4:59 am
Viewing 15 posts - 1 through 15 (of 16 total)