Forum Replies Created

Viewing 15 posts - 1,021 through 1,035 (of 1,315 total)

  • RE: Pre-checking foreign key constraints and default value -- best way?

    You could change all your inserts to this form:

    insert into target (...)

    select ...,

       isnull(fk1.value1, FK1_DEFAULT),

       isnull(fk2.value2, FK2_DEFAULT),

       ...

    from source s

    left join otherdb..lookup1 fk1 on...

  • RE: Server Registration via SQL DMO

    This is a great idea, but I had to tinker with it.  We have remote production servers visible over a VPN only by TCP/IP address, so I had to add...

  • RE: SQL to identify missing Stored Procs across servers

    Yes.  Either that or "a.xtype in ('P','U','V','FN','IF','TF')"

  • RE: SQL to identify missing Stored Procs across servers

    Don't forget xtypes IF and TF (table-valued functions).

  • RE: SQL to identify missing Stored Procs across servers

    You'll probably have problems with using information_schema views as a linked server reference.  It may work with the master db but not others.

    Replace the four-part name with an OPENQUERY function.

    select r1.routine_name, r1.routine_type

    from...

  • RE: LEFT OUTER JOIN Teaser

    So what does your book say in what cases the returned value is neither check_expression nor replacement_value?

    Does it maybe say to go back and reread the original post because you...

  • RE: Hide Relations into Database

    The field(s) referenced by a foriegn key must have a unique constraint, which will have an index.  It could be a primary key or a unique index, but even a...

  • RE: Question of the Day for 30 Sep 2005

    I got this one right, but I would agree with anyone who said there should be two correct answers.  If the distribution agent is running on the subscriber, then 'distributor' and...

  • RE: LEFT OUTER JOIN Teaser

    You don't get the error if you follow the directions.  There is no val column in the table, only in the view.

    Gift Peddie: I don't think the rest of us...

  • RE: LEFT OUTER JOIN Teaser

    I don't see what collation has to do with it, there are no character fields.

    It doesn't look like you used the WHERE clause in the view definition.  Rows 5-8 should...

  • RE: LEFT OUTER JOIN Teaser

    The WHERE clause in the view has nothing to do with it, and neither does the fact that it is a self-join.

    If you create the view on a second table (with...

  • RE: Matching Debits to Credits

    If you want to check whether any subset of the debits exactly equals any subset of the credits (not to mention being off by a penny), I think you may...

  • RE: Duplicates

    I would try one of these two methods, depending on the frequency of duplicates.  The first one uses 11 update statements but only updates the rows that need it.  The...

  • RE: Matching Debits to Credits

    It also occurred to me that the problem statement was a gross oversimplification of a full-blown accounting system.  It is also stated that this is currently being done manually, so we're...

  • RE: Matching Debits to Credits

    update t set Allocation = 1

    from transactiontable t

    inner join (

       select Accnt_code from transactiontable

       from transactiontable

       group by Accnt_code

       having sum(Other_amt) = 0

    ) a on t.Accnt_code = a.Acctn_code

    where Allocation is null...

Viewing 15 posts - 1,021 through 1,035 (of 1,315 total)