| |
| |
| |
|
Page: 1 2 3 4 5
Comments:
<0> :p <0> <3 <1> Arrakis : Do you mean "you continue" ? :-P <2> i would suggest, however, that re-seeding the random number generator in ms-sql with current time to the millisecond each time it's used will be a good start <1> Yuppie : yeah, it was a suggestion made on one web-site but he reported that it didn't provide sufficiently random results for some reason - perhaps because calculations are just that fast, I'm not sure <0> are you going to take some ****tards word for it ? <0> lol <2> so just use an external rnd generator - write one in c++ and call it from ms-sql <2> or, as i suggested earlier, use one done in c# <2> givne that ms-sql2k5 supports that now... <1> if I must I'll do it post-query like you're suggesting... it's just that it takes more processing power to go through retrieving a larger set of all possible incorrect answers, then running through them with a random number generator in post-query code. <0> you're talking about creating x amount of GUIDs ? <0> as opposed to a seeing a generator? <2> not if you're correctly normalised - that way you're only returning a list of answer ids and picking randomly from that <2> rather than pulling back the entire list of possible answers' text <2> or, as i keep saying, write something in c# to use within ms-sql2k5
<1> yeah, I might have to end up doing that then unfortunately. I was hoping it wouldn't be a complicated and time consuming effort is all <2> well, it won't be <2> prolly take 5 mins <3> Ok, I didn't realize you could code sprocs in .NET languages with mssql 2k5. That's a huge. <2> Drk`Angel : yup <2> Drk`Angel and anyone else interested : http://download.microsoft.com/download/f/a/a/faace3f4-03c1-4455-8acd-a8d7ad959ab3/SQLServerExpressSamplesOverview.htm <2> second item called "sql server 2005 samples" <4> you must've been some trouble to get to that page... <3> Oh man, I may have to actually try to convice my boss to upgrade. <3> Crap. :) <4> do it do it do it! :) <4> well i convinced my boss to let me swich from vb6 to c# for my next project ~ <3> Working on moving some data out of a freaking ancient Oralce 7.2 database to something newer so maitenance is easier until we can replace the whole system. <4> Drk`Angel:: oracle to something newer? gosh, i have to move some old Foxpro database in DOS that was created in like 1970s <4> to MS SQL 2000... <4> but since i am leaving the company, i don't want to worry about it <3> d2d: Well, I didn't mention the ancient dos based system using clipper and dbase that we're migrating to msde :) <4> hmm.. to msde... that sounds... worse :) <3> The place I'm working now basically had no IT department for about 10 years at one point, so all of their tech is REALLY old. <1> Have they changed the syntax of a view in 2005? suddenly I'm getting an error <3> I feel like I'm working at a musem sometimes. <4> i see.. kind of in the same situation i am facing here <1> create view viewName select * from blah right? <5> as <5> i think that was last changed in 1992 <2> indeed <2> create view blah as select * from table <1> actually I had the "as"... accidentally didn't type it <1> still getting an error - weird <2> maybe you should tell us what the error is? <2> just a thought <3> How would that be useful? ;) <4> Eeker:: you can paste your query on the site listed on #sql topic <1> Incorrect syntax near the keyword 'view'; <4> what's your "viewname" <4> well just paste the darn query darn it ! :) <1> http://sql-servers.com/nopaste/?show=334 <2> wtf? <2> a stored proc that creates a view? <4> wth <1> maybe I misunderstand the purpose of a view <2> i think you do <4> Eeker:: if you really want to pull that off, you can use hmm... dynamic sql <3> I'm thinking yes. <4> but i don't think you shouldn't ... <4> s/don't think/think <1> I guess what I need to make is a temp table <1> that's it <3> What, exactly, are you trying to do? <2> man, that is *so* broken <3> Other than just stabbing in the dark? <5> or uhh, just remove the whole create view crap and leave the selects and you're on the right track <1> I'm trying to find a simpler randomizing solution than going and writing my own randomizer. Those two select statements individually properly give the two components I need <1> but if I union them it doesn't work <2> you don't need a temp table, just a union <5> what doesnt work if you union them? <3> Why in the name of all that's holy isn't your first query "select @elementid" ? <2> select id from table where id = @id union select id from (select top 3 id from table where not (id=@id) order by newid()) <2> is how you do that <2> Drk`Angel : good point <5> because its a parameter
<3> So? <2> phargle : doesn't make a difference <5> whats the significance of having a select @elementid? <3> I mean, maybe he's verifying that the row exists ... but based on the rest of the query, I really doubt it. <1> my first query's not select @elementid because I want more than just the elementid <2> the only time you can't select a variable into an result set is when you're using mysql <1> it's a foreign key in another table <3> eeker: All you're returning right now is the elementid anyways. <2> Eeker : then why are you not selecting it? <2> s/it/them <5> makes no sense.. <2> Eeker : anyway, that's neither here nor there <1> in what you guys see, yeah - sorry <2> select id from table where id = @id union select id from (select top 3 id from table where not (id=@id) order by newid()) <1> it used to be a * <2> is what you need <1> I actually need the sub-select twice... on the first one too since there can be more than one right answer <1> as I said, the id is a foreign key <1> but otherwise, I'll give it a shot <2> well, you never said before that there could be more than one right answer <1> sorry <2> otherwise i'd have given you different code <5> can an answer be both wrong and right? <3> You could just write a function that returns the result set too. <3> No reason to toss it into a view or a temp table. <2> indeed - my code was a replacement for the creation of the views - i should have been clear about that <2> right - biab <1> his code is giving me an error <6> why aren't you randomizing your result set in your consumer? <5> i recommend using randomizer logic that makes the correct answer always "C" <5> it helps with testtaking and all <1> MuteThis : my consumer? <6> yes, the code that is requesting the result set <6> it should randomize <6> for example, why have two procs, spGetResponses and spGetResponsesRandom <6> just have one and let the consumer randomize if necessary <1> I'm sorry - I still don't understand what you mean by the consumer <1> you mean in my C# code? <1> in asp.net? <6> yes <1> that means I'd have to return the full set first... <1> but my query limits to only 4 total records <1> I don't wanna have to return all those records first and then randomize them <6> sounds to me like you should cache the table and then pick a random four from it <5> random 3 + 1 correct answer <1> ok, I finally got it <1> yep, exactly what I did <1> MuteThis had such a simple answer and that was what I was going for <1> I used temp tables and it worked beautifully <6> no no, i meant something else :) <1> for anyone who's interested -- this is literally the ONLY damned way to get independent randomization of both selects in a union that is then joined and randomized yet again <1> oh, well what I did worked beautifully <1> I am the champion, my friends <1> hehe <6> </sacrasm> <6> ... <1> pastebot <1> http://sql-servers.com/nopaste/?show=335 <1> that was one bitch of a task <1> thank god that's done <1> ok, heading to bed <1> g'nite all <7> hi all <7> I have a sql server 2005 table with an identity primary key int with a lot of holes between the primary key values. For example PK p*** directly from 234234 to 355432. Can i rebuild the PK? <8> why do you want to? <7> Because I usually make select using this pk with between clause <9> omfg, why? <8> so? you will still get them even if there's holes there <8> BETWEEN 2 AND 10 <8> even if 2 and 10 are the only one existing in that range, you'll get those <7> yes, using between 100000 and 200000 returns 90000 records, but from 200000 and 300000 returns 1 record only <7> and so on <8> so? <8> if you want a sequential key then you need to either rebuild after each delete, fill in the gaps when you insert, or not delete at all
Return to
#sql or Go to some related
logs:
bug spincer #flash linkd network share
the most important province in canada
#beginner irc from a nameserver #windows #redhat #nhl oxycottin heroin
|
|