Forum Replies Created

Viewing 15 posts - 556 through 570 (of 582 total)

  • RE: eliminating duplicates from stored procedure joins

    You may be pleased (kind of!) to know that the reason you have had so much trouble is that what you are trying to do is logically impossible.

    You don't have...

    Tim Wilkinson

    "If it doesn't work in practice, you're using the wrong theory"
    - Immanuel Kant

  • RE: eliminating duplicates from stored procedure joins

    David,

    true. I was assuming that the tables don't contain duplicate rows, but are in the usual kind of many-to-one (master-detail, parent-child) relationship.

    Tim Wilkinson

    "If it doesn't work in practice, you're using the wrong theory"
    - Immanuel Kant

  • RE: eliminating duplicates from stored procedure joins

    Just reread your last post, and the answer to your question

    quote:


    in one table there are duplicate case no.s and in...

    Tim Wilkinson

    "If it doesn't work in practice, you're using the wrong theory"
    - Immanuel Kant

  • RE: eliminating duplicates from stored procedure joins

    So you haven't actually got duplicate rows.

    I suspect what you've got is a so-called 'fan trap'.

    This happens when you have two many-to one relationships. Lokking at your query, this may...

    Tim Wilkinson

    "If it doesn't work in practice, you're using the wrong theory"
    - Immanuel Kant

  • RE: eliminating duplicates from stored procedure joins

    OK - sorry, wasn't trying to nitpick, but I use a similar method - I literally and figuratively see red when I open a stored procedure to find it is...

    Tim Wilkinson

    "If it doesn't work in practice, you're using the wrong theory"
    - Immanuel Kant

  • RE: Nested transactions in nested sprocs- possible?

    The answer to your last question is yes. Commit and Rollback are alternative ways of closing a transaction. Once you have rolled back (or committed) a transaction, there is of...

    Tim Wilkinson

    "If it doesn't work in practice, you're using the wrong theory"
    - Immanuel Kant

  • RE: eliminating duplicates from stored procedure joins

    Sorry to deviate, but a quick question for DaveB:

    "AND(@param12 IS NULL OR (@param12 IS NOT NULL AND [on hold code] = @param12))"

    -Is there any particular reason for including the redundant...

    Tim Wilkinson

    "If it doesn't work in practice, you're using the wrong theory"
    - Immanuel Kant

  • RE: Email problem

    Need more info - can you show us the DDL from the accidents table?

    Exactly what is it that you are trying to work out? Are you trying to calulate the...

    Tim Wilkinson

    "If it doesn't work in practice, you're using the wrong theory"
    - Immanuel Kant

  • RE: using "IN" in my query ... suggestions?

    Nothing very original - a suggestion for implementing the ideas already given, and for amnding the SQL to run as a simple SELECT statement:

    --DDL:

    create table custlist(id int identity(1,1), custid int,...

    Tim Wilkinson

    "If it doesn't work in practice, you're using the wrong theory"
    - Immanuel Kant

  • RE: Not in

    No - I think it *is* the way to go. Joins are the standard and normally the best method, and Steve Jones' suggestion is certainly the way I, and most...

    Tim Wilkinson

    "If it doesn't work in practice, you're using the wrong theory"
    - Immanuel Kant

  • RE: Dynamic Views

    That's in SQL 7 - SQL 8 might be different. we haven't upgraded...yet.

    Tim Wilkinson

    "If it doesn't work in practice, you're using the wrong theory"
    - Immanuel Kant

  • RE: Dynamic Views

    Oh I see. OK - from memory, you can use:

    declare cr_ViewText

    cursor fast_forward

    for

    select c.text from syscomments c

    join sysobjects o

    on c.id = o.id

    where o.name = @ViewName

    order by c.colid asc

    That...

    Tim Wilkinson

    "If it doesn't work in practice, you're using the wrong theory"
    - Immanuel Kant

  • RE: Comparison of two tables

    If you want to compare only using column names, replace the whole section of code with

    IF 1=2

    Tim

    Tim Wilkinson

    "If it doesn't work in practice, you're using the wrong theory"
    - Immanuel Kant

  • RE: Comparison of two tables

    you can amend the script lowell refers to. At line 302, you will see the following code:

    IF EXISTS(SELECT COLUMN_NAME,

    DATA_TYPE,CHARACTER_MAXIMUM_LENGTH,

    CHARACTER_OCTET_LENGTH,

    NUMERIC_PRECISION,

    NUMERIC_PRECISION_RADIX,

    NUMERIC_SCALE,

    DATETIME_PRECISION,

    COUNT(*) AS NUMBERS

    FROM #TableColumns

    GROUP BY COLUMN_NAME,

    DATA_TYPE,CHARACTER_MAXIMUM_LENGTH,CHARACTER_OCTET_LENGTH,

    NUMERIC_PRECISION,NUMERIC_PRECISION_RADIX,

    NUMERIC_SCALE,

    DATETIME_PRECISION

    HAVING COUNT(*)=1)

    If...

    Tim Wilkinson

    "If it doesn't work in practice, you're using the wrong theory"
    - Immanuel Kant

  • RE: Not in

    ian - i don't see how what you describe can happen unless the query is more complex than the one shown. I assume you are not suggesting that the query...

    Tim Wilkinson

    "If it doesn't work in practice, you're using the wrong theory"
    - Immanuel Kant

Viewing 15 posts - 556 through 570 (of 582 total)