Forum Replies Created

Viewing 15 posts - 301 through 315 (of 7,164 total)

  • RE: about @identitiy(1,1)

    If you want to ensure no duplicates enter the table then you should declare your IDENTITY column to be unique either as the primary key or with a unique index...

    There are no special teachers of virtue, because virtue is taught by the whole community.
    --Plato

  • RE: SQL, and Ye Shall Find

    I wonder sometimes if SQL Server needs a reboot. In a lot of places its Sybase roots are still showing (e.g. CONVERT, DECIMAL/NUMERIC, UPDATE...JOIN, @@, etc.). The need to maintain...

    There are no special teachers of virtue, because virtue is taught by the whole community.
    --Plato

  • RE: Limit insert of column value

    what we want are the supporting objects that will help us run your code on our machine. make it easier for us to help you.

    There are no special teachers of virtue, because virtue is taught by the whole community.
    --Plato

  • RE: Query result with a value condition

    Arrgh, so ignore my last set of results. I was not comparing apples to apples. I just ran all three with the indexes I built and while my solution continues...

    There are no special teachers of virtue, because virtue is taught by the whole community.
    --Plato

  • RE: Query result with a value condition

    Thanks for the test-harness Jacob! I think I managed to remove one use of LAG from my query (and still attain the correct result) and it seems to have dramatically...

    There are no special teachers of virtue, because virtue is taught by the whole community.
    --Plato

  • RE: Limit insert of column value

    Please post DDL (CREATE TABLE) including indexes and constraints and DML (INSERT INTO) statements to allow us to create a test area on our side.

    There are no special teachers of virtue, because virtue is taught by the whole community.
    --Plato

  • RE: Query result with a value condition

    OK, I'll go with it...

    This query has a lower plan cost than the other two solutions that seem to satisfy the requirements (Jacob's and Drew's) but I haven't tested...

    There are no special teachers of virtue, because virtue is taught by the whole community.
    --Plato

  • RE: Query result with a value condition

    ssc_san (2/4/2016)


    Thank you all for the replies!

    @jacob Wilkins - You are correct, if there are two or more MtchId's with "Phone", "Online" and other OrdLoc's I want to display only...

    There are no special teachers of virtue, because virtue is taught by the whole community.
    --Plato

  • RE: Query result with a value condition

    I see what you are pointing out now, that before we decide to return an online order we must first know there was a phone order for that OrdID. Sounds...

    There are no special teachers of virtue, because virtue is taught by the whole community.
    --Plato

  • RE: What is the True Version of Code?

    Phil Parkin (2/4/2016)


    Orlando Colamatteo (2/3/2016)


    removed silly post...

    Your own, presumably? 🙂

    Yeah, just some misplaced humor I didn't want mistaken for something that might take away from this thread. This written stuff...

    There are no special teachers of virtue, because virtue is taught by the whole community.
    --Plato

  • RE: Query result with a value condition

    This one seems to do quite a bit better than the others on elapsed time:

    with cte as (select distinct OrdID

    ...

    There are no special teachers of virtue, because virtue is taught by the whole community.
    --Plato

  • RE: Query result with a value condition

    Jacob Wilkins (2/3/2016)


    I think the code below does what you want, if I understand the requirements correctly. It scans each table twice, so if the source tables are very large...

    There are no special teachers of virtue, because virtue is taught by the whole community.
    --Plato

  • RE: Help with xp_cmdshell folder creation

    CRMUK (2/3/2016)


    What about production support, ETL or other backend activities? Never is a tough standard to live up to.

    Very true..

    I did amend the insert value as suggested.

    Many thanks

    Great, now show...

    There are no special teachers of virtue, because virtue is taught by the whole community.
    --Plato

  • RE: Help with xp_cmdshell folder creation

    CRMUK (2/3/2016)


    select @recordid = recordid from inserted

    The OP will find out soon enough what the problem is when they attempt their trigger with more than 1 row :w00t:

    Thanks for...

    There are no special teachers of virtue, because virtue is taught by the whole community.
    --Plato

  • RE: Query result with a value condition

    Here is an option that I think does a little less work but I am still not crazy about needing to use row_number. I think there is still a better...

    There are no special teachers of virtue, because virtue is taught by the whole community.
    --Plato

Viewing 15 posts - 301 through 315 (of 7,164 total)