Forum Replies Created

Viewing 15 posts - 4,711 through 4,725 (of 10,144 total)

  • RE: inherited an app, Error started the next day

    I'd check for NULL decsription in the source table:

    DECLARE MOVEITEMS_CUR CURSOR FOR

    SELECT MOVEITEMSID, MOVEDATE, ITEMID, [DESCRIPTION], USERID

    FROM MYOB_IMPORT..MOVEITEMS

    WHERE [DESCRIPTION] IS NOT NULL

    The code is horrible! I gave...

  • RE: Stuck with a getdate time range?

    Can you work it out from this:

    SELECT

    d.Today,

    StartTime = DATEADD(hour,8,d.Today),

    EndTime = DATEADD(hour,10,d.Today)

    FROM (SELECT Today = CAST(CAST(GETDATE() AS DATE) AS DATETIME)) d

  • RE: VIEW vs. DynamicSQL

    Is column [LINE_CODE] correctly populated in all of the tables?

  • RE: Use of rownum function in a select

    -- use proper join syntax

    -- don't use double-quotes for identifiers unless absolutely necessary

    -- write queries using TOP 1...ORDER BY and ROW_NUMBER() and choose quickest of the two

    -- CROSS APPLY is...

  • RE: Really Challenging Query: Break out average value across months

    -- Expanding the date range out by months rather than days might be 30x cheaper

    ;WITH OrderedData AS (

    SELECT *,

    rn = ROW_NUMBER() OVER(PARTITION BY AccountID ORDER BY DataDate DESC)

    FROM...

  • RE: Error converting varchar to numeric only in where clause

    Evil Kraig F (4/26/2013)


    ...Thanks for taking the time to show me in a slightly different way...

    Welcome. It's one of those things we take for granted after a while, not really...

  • RE: How to merge two sql select statement results I tried it but it not get please see it in detailed explination with my query

    UNION on it own dedupes the result set which is almost certainly not what you want.

    Try combining the two queries into one so you're not reading tables twice, unnecessarily:

    SELECT

    TT.ID,...

  • RE: Inserts are slow

    rcarrier (4/28/2013)


    ...

    One source system transaction may need to have several inserts created in the destination table and its a complicated process to determine this.

    ...

    "Complicated" is a relative word. If you're...

  • RE: Complex many to many relationships

    Ganga-236835 (4/26/2013)


    ChrisM@Work (4/26/2013)

    Those are 'organisations'...

    Well, not quite. There could be multiple regional offices for "Organizations", with each one having their own unique set of phone numbers. ...

    G.

    Those are 'rows' in...

  • RE: Complex many to many relationships

    Ganga-236835 (4/26/2013)


    ChrisM@Work (4/26/2013)

    Those are 'organisations'...

    Well, not quite. There could be multiple regional offices for "Organizations", with each one having their own unique set of phone numbers. Again, for the purposes...

  • RE: Complex many to many relationships

    Ganga-236835 (4/26/2013)


    patrickmcginnis59 10839 (4/26/2013)

    This is an interesting case, so I'm guessing that it really depends on how important the functionality of the foreign key constraint is for your needed functionality....

  • RE: Complex many to many relationships

    Ganga-236835 (4/26/2013)


    ....

    Adding these columns to each parent's object just does not make sense. There is no supporting case, at least in this system, where it would make sense to add...

  • RE: Complex many to many relationships

    Lynn Pettis (4/26/2013)


    If a phone number can only belong to one entity, why are you trying to make it a many to many relationship?

    +1

  • RE: Complex many to many relationships

    Ganga-236835 (4/26/2013)


    Although I agree in principle that most common scenario regarding phone numbers is that there is one per person, in the system that I am designing that is just...

  • RE: Complex many to many relationships

    davidandrews13 (4/26/2013)


    is it possible, or even considered OK, to put all your different Members tables (Clients, Staff, Managers) into one table called 'Clients', and have a Foreign Key to a...

Viewing 15 posts - 4,711 through 4,725 (of 10,144 total)