| |
| |
| |
|
Page: 1 2
Comments:
<0> Cant say I really understand it, but I am no guru <1> :) <1> no prob.. thanks.. been around this for hours <0> I kinda bug me about this: <0> # <0> SET @counter = 0 <0> # <0> while @counter < 11531 <0> AH <0> uhu <1> ... <0> Why is there 3 select statements ? <1> the one in the if statement was just to ignore the null values.. <1> but i still get them <0> Its not possible putting all tha tin one select?
<0> that in* <1> let me past the table im iterating... <1> Server: ptn-cdns01.plus.net <1> Address: 212.159.6.9 <1> NULL <1> Name: dhcp-jmh-44.oriel.ox.ac.uk <1> Address: 163.1.155.44 <1> NULL <1> Server: ptn-cdns01.plus.net <1> Address: 212.159.6.9 <1> NULL <1> Name: VA1-1B-u-0919.mc.onolab.com <1> Address: 62.42.7.152 <1> NULL <1> i only want the ones with NAME and ADDRESS <0> Hmm <0> First col is ID, second ns ? <1> yes <0> Okey. You are counting 'em ? <0> You only want the count ? <1> nnot the count.. <1> i want the rows that start with 'name%' and the row after <0> Cant it simply be made something like this: <0> select * from temp where id is not null and ns like 'name%' and ns like 'address%' <1> if i set the @id value manually.. it works.. but with the loop it doesnt.. <0> Ok. <1> hmm the thing is the two consecutive lines are related... <0> You sure it picks up the @counter value correctly ? <1> yes.. used it before and tested <1> and it is a simple counter isnt it? :) <0> Hmm <1> select @ClientHostName=ns from [temp] where id=@counter and ns like 'name%' <1> the reason i have that... is so i can get the value of the next line as @counter +1 <0> What if you type 'Name%' ? <0> (case sensitive)? <1> hmm <0> Also try id=(@counter+1) if there is any problem with that part. <0> What if you simple remove that first select statement: if (select bla bla) <0> and just added on the 2nd select ' id is not null ' <0> +AND <1> doing that.. <1> i cant have id is not null because i need to get the row straight after he finds the 'name%' <0> Ah <0> But if the text 'name%' exists, there is no null ? <0> So why even care about checking null? <0> Just check for name% <0> I must admit that I dont really get the db design from the paste above =) <1> i did a print of the variables <1> print @ClientHostName+ ' -- ' +@ClientIP+ ' ' +cast(@id as varchar(2)) <1> look what i get <1> Name: dhcp-jmh-44.oriel.ox.ac.uk -- Address: 163.1.155.44 4 <1> <1> Name: dhcp-jmh-44.oriel.ox.ac.uk -- Server: ptn-cdns01.plus.net 7 <1> Name: dhcp-jmh-44.oriel.ox.ac.uk -- Address: 212.159.6.9 8 <1> <1> Name: dhcp-jmh-44.oriel.ox.ac.uk -- Name: VA1-1B-u-0919.mc.onolab.com 10 <1> Name: VA1-1B-u-0919.mc.onolab.com -- Address: 62.42.7.152 11 <0> I see, its those nulls you want to ditch.
<1> yes <1> but i dont mind them.. <0> where len(id)>0 ;P <1> i just dont understant what's happening <0> Okey, what if you just do that in two separate lines ? <0> if id is not null and bla=name <0> counter++ <0> and then get the address <0> counter++ <0> Then go back to top of loop again <1> that would be another way... <0> Am I correct that you select statement right now, is just one long ****er? <0> your* <1> i could for instance do Select ns from temp where ns like 'name%' <1> that works... <1> but then i wouldnt know how to get the other lines related <0> And put the IF() around that part. <0> And do counter++, and get next line. <0> Which is address <0> Line 13, is that some kinda invisible 'end if' ? <1> yes :) <0> k. <1> can i use end if? <0> Easy, I think. <0> w8 <1> ok <0> Hmm, damn nice. *couch* <0> ------ <0> IF (SELECT ns FROM [temp] WHERE id=@counter) IS NOT NULL <0> SELECT @ClientHostName=ns FROM [temp] WHERE id=@counter AND ns LIKE 'name%' <0> set counter++ <0> foo=true <0> end if <0> if foo=true <0> SELECT @ClientIP= ns FROM [temp] WHERE id=@counter <0> foo=false <0> endif <0> SET @counter = @counter + 1 <0> ----- <0> eh? =) <1> hmm <1> ill give it a try <0> After spending hours, anything is possible, and worth checking out. =) <1> looks good <1> exactly! <1> was just about to break this whole thing <0> Heh <0> Well? <1> dont wanna start making a party but im having different results.. (need to know if they're right) :) <1> had to take the foo part.. was getting strange errors.. may have to put it back as a boolean var <0> Well, boolean was what I meant. <0> You will finish that. <0> /Head for bed <0> heads <1> ight.. thanks a bunch for the insight <0> np <1> tell u how it worked out :) <1> later <0> Sure <2> if I have two tables, a users and transaction table. The two are linked by user_id. I would like to select all from the trasnactions table and also grab the user.name field, but i've found that if a user cnanot be matched with the transaction.user_id, it doesn't show. How can I have it just be a blank name? <2> select user.name, transaction.* from user, transaction where user.user_id = transaction.user_id <2> is what I have <3> Hello...what is the best way when atrigger fired in sql server ***ign afunction in asp.net that take the trigger parameter as it's parameter... where shall i write such afunction? <3> How can atrigger found in sqlserver call afunction with parameter in asp.net? <4> hello <4> wait <4> is it death anniversarry of codeslinger? <4> hello <4> how can check if there's an error in my bulk insert? <4> is it using @@error? <5> hi guys <5> mms://win.global.playstream.com/screenplay/open/232/e232653t.asf <5> when i paste it .. it get streamed from online
Return to
#sql or Go to some related
logs:
ninjachrist indian midnite masala #3dstudiomax mysql_fetch_result php #kl #india Serkan Balc Fener #allnitecafe #allnitecafe surabaya under cover
|
|