Re: Query Help with IF stmt



On Fri, 1 Apr 2005 14:43:05 -0800, Andy wrote:

>Thanks Hugo. It works great. Still little problem. I rushed the question and
>clarify.
>I am trying to pick employee randomly. So the rank field suppost to start be
>like
>EmpName EmpRank
>a 1
>b 2
>c 3
>d 1
>e 2
>f 3
>g 1
>h 2
>i 3
>
>For one system I will use all "1" and for other all "2" etc.
>Thanks
>Andy

Hi Andy,

I don't really understand your requirement. You're talking about
"random", but the example above doesn't look very random - it looks like
something that can be done using the ASCII function and the % (modulo)
operator. OTOH, I suspect that the EmpName column in reality won't hold
one-letter values.

I also don't understand what you are actually trying to achieve. In
fact, I have the feeling that this is just one step in a process to get
something done - but I'm not sure if there is no better way to achieve
the other steps.

I suggest you post the following information:

1. The structure of your tables (posted as CREATE TABLE statements, with
all constraints and properties included, though you may omit irrelevant
columns).
2. Some rows of sample data (posted as INSERT statements). They need not
be real, but they should be realistic (e.g. use John Brown / Jack Green
/ etc as names, not a / b / etc).
3. The output you expect from that sample data - and indicate clearly
which part of the data should be randomized and how.
4. A description of the actual business problem you're trying to solve.

Check out www.aspfaq.com/5006 as well.

Best, Hugo
--

(Remove _NO_ and _SPAM_ to get my e-mail address)
.



Relevant Pages

  • Re: Select statement
    ... Sample data ... Expected output ... Best, Hugo ... (Remove _NO_ and _SPAM_ to get my e-mail address) ...
    (microsoft.public.sqlserver.programming)
  • Re: Difference between = and IN
    ... I misunderstood what you meant in the previous post. ... strange results if Nulls were present in the records whereas NOT ... "Hugo Kornelis" wrote: ... > Hi Andy, ...
    (microsoft.public.sqlserver.mseq)
  • Re: Difference between = and IN
    ... That's a relief I didn't fancy having to re-check all my databases!!! ... also nice to know I'm not a complete eejit! ... "Hugo Kornelis" wrote: ... > Hi Andy, ...
    (microsoft.public.sqlserver.mseq)
  • Re: extreme help with query of 2 tables into 1 long table
    ... When you say "front end/presentatio layer" can I import and do in access or ... "Hugo Kornelis" wrote: ... > structure and sample data, ...
    (microsoft.public.sqlserver.mseq)
  • Re: TRICKY SQL
    ... irrelevant columns) and your sample data as INSERT statements, ... Best, Hugo ... (Remove _NO_ and _SPAM_ to get my e-mail address) ...
    (microsoft.public.sqlserver.programming)