Re: Querying a database

Tech-Archive recommends: Speed Up your PC by fixing your registry




"onecorp" <onecorp@xxxxxxxxxxxxxxxx> wrote in message
news:967EF0A1-DA3C-4AA1-AC62-A5693A6D455F@xxxxxxxxxxxxxxxx
Dear Dmitriy Antonov,

I have run your suggestion and have the following queries, if I may:

A)
(I made one small adjustment to your first suggestion in order to exclude
the Id column from the query, as follows:

If @Cols <> 'Id'
Set @qry='Select Count(*) From SPF Where (' + @qry + ')>1'

--Print @qry
Execute(@qry)
)

But 'Id' is not supposed to be passed as a parameter at all. As shown, you
don't exclude a column - you exclude everything - nothing is returned, when
parameter is equal to 'Id' (which should not happen, in my understanding).

I executed the query on a table of 30 columns (adjusted the count as
necessary) using columns labelled 1, 2, and 3 . It returned a value of 34,
however, the answer should have been 3. Three is the number of times that
one
simultaneously appears in each of the aforementioned columns ie . I only
wish to count the number or times that '1' appears in the nominted columns
simultaneously, whether I am checking two columns at a time or three
columns
( or even 4 columns....which is why I thought that the query should be
built
in managed code(VB .net) using SQL CLR ?????).

I am confused. Now I don't understand your specification and you need to
start over and explain what you are trying to do.


B)When I tried to use a table with 38 columns , I received the following
error:

Msg 217, Level 16, State 1, Procedure spMyTest2, Line 45
Maximum stored procedure, function, trigger, or view nesting level
exceeded
(limit 32).

even after ensuring that I adjusted the count correctly....

You said you are trying my "first suggestion" but spMyTest2 was my second
one - which one do you use? Anyway, none of them should give you this error,
so I can just assume that you didn't use my code as presented and changed it
in some inappropriate way - seems like you use recursive calls from the
procedure to itself.


C) This procedure appears to only return one value based on inputting the
paramters as indicated. For a table that contains 38 columns, there should
be
8436 values. Are you able to give me a clue as to how to return a list of
all
the combinations, not just one?

As I said above, I don't understand your specification now and, unless you
clarify it, can't give you any other solution.


Dmitriy.


.



Relevant Pages

  • Re: Querying a database
    ... "Dmitriy Antonov" wrote: ... (I made one small adjustment to your first suggestion in order to exclude ... Maximum stored procedure, function, trigger, or view nesting level ... You said you are trying my "first suggestion" but spMyTest2 was my second ...
    (microsoft.public.vb.database)
  • Re: NName Group
    ... Here's an adjustment to my first suggestion that does what you want, ... HTH, ... George Nicholson ...
    (microsoft.public.access.reports)