Forum Replies Created

Viewing 15 posts - 871 through 885 (of 1,228 total)

  • RE: Error in my SQL Statement

    Faye Fouladi (4/27/2011)


    The following sql statement gives this error:...

    any idea what is wring?

    Thank you

    Yep, it took about 4 seconds.

    Put a PRINT statement right before the EXEC:

    PRINT @SoftwareQuery

    and have...


    [font="Arial"]Low-hanging fruit picker and defender of the moggies[/font]

    For better assistance in answering your questions, please read this[/url].


    Understanding and using APPLY, (I)[/url] and (II)[/url] Paul White[/url]

    Hidden RBAR: Triangular Joins[/url] / The "Numbers" or "Tally" Table: What it is and how it replaces a loop[/url] Jeff Moden[/url]

  • RE: How to avoid aggregate functions and TOP/BOTTOM ?

    Igor Savin (4/27/2011)


    This my table :

    CREATE TABLE TAB1

    (

    curr tinyint NOT NULL ,

    ddate smalldatetime NOT NULL ,

    rate decimal(15, 4) NOT NULL ,

    primary key (curr, ddate)

    )

    If "rate" didn't change in comparision...


    [font="Arial"]Low-hanging fruit picker and defender of the moggies[/font]

    For better assistance in answering your questions, please read this[/url].


    Understanding and using APPLY, (I)[/url] and (II)[/url] Paul White[/url]

    Hidden RBAR: Triangular Joins[/url] / The "Numbers" or "Tally" Table: What it is and how it replaces a loop[/url] Jeff Moden[/url]

  • RE: Recursive CTE

    Hunterwood (4/27/2011)


    Hi Chris,

    I don't know why, but it seems as if the CTE first follow one branch to the top, before following the next, but then all by a sudden...


    [font="Arial"]Low-hanging fruit picker and defender of the moggies[/font]

    For better assistance in answering your questions, please read this[/url].


    Understanding and using APPLY, (I)[/url] and (II)[/url] Paul White[/url]

    Hidden RBAR: Triangular Joins[/url] / The "Numbers" or "Tally" Table: What it is and how it replaces a loop[/url] Jeff Moden[/url]

  • RE: An Alternative for DISTINCT AND GROUP BY by using ROW_NUMBER()

    ASFSDJG (4/27/2011)


    Yes I got the solution !!

    SELECT Column1

    FROM

    (SELECT ROW_NUMBER() OVER (PARTITION BY Column1 ORDER BY Column1) As RNO, Column1

    from

    <Table_Name>)A WHERE RNO = 1

    Here's another solution.


    [font="Arial"]Low-hanging fruit picker and defender of the moggies[/font]

    For better assistance in answering your questions, please read this[/url].


    Understanding and using APPLY, (I)[/url] and (II)[/url] Paul White[/url]

    Hidden RBAR: Triangular Joins[/url] / The "Numbers" or "Tally" Table: What it is and how it replaces a loop[/url] Jeff Moden[/url]

  • RE: Insert Records In a tmp table

    with actuals as (...),

    goals as (...)

    INSERT INTO tmp_f_contrib_annual_agg (

    --put column list in here

    )

    select

    ...

    from actuals a

    full outer join goals g

    on g.credit_org_key =...


    [font="Arial"]Low-hanging fruit picker and defender of the moggies[/font]

    For better assistance in answering your questions, please read this[/url].


    Understanding and using APPLY, (I)[/url] and (II)[/url] Paul White[/url]

    Hidden RBAR: Triangular Joins[/url] / The "Numbers" or "Tally" Table: What it is and how it replaces a loop[/url] Jeff Moden[/url]

  • RE: Recursive CTE

    Hunterwood (4/27/2011)


    ...

    Now I think you can figure it out... 🙂

    /Markus

    Hi Markus

    I can't figure out how you have a 3.n in your third recursion.

    Reference: http://msdn.microsoft.com/en-us/library/ms186243.aspx

    Edit: added reference.


    [font="Arial"]Low-hanging fruit picker and defender of the moggies[/font]

    For better assistance in answering your questions, please read this[/url].


    Understanding and using APPLY, (I)[/url] and (II)[/url] Paul White[/url]

    Hidden RBAR: Triangular Joins[/url] / The "Numbers" or "Tally" Table: What it is and how it replaces a loop[/url] Jeff Moden[/url]

  • RE: Recursive CTE

    A recursive CTE can be difficult to interpret. I find it helps to map out the first few iterations using chained CTE's like this;

    ;WITH CTEAnchor (x) AS (SELECT x =...


    [font="Arial"]Low-hanging fruit picker and defender of the moggies[/font]

    For better assistance in answering your questions, please read this[/url].


    Understanding and using APPLY, (I)[/url] and (II)[/url] Paul White[/url]

    Hidden RBAR: Triangular Joins[/url] / The "Numbers" or "Tally" Table: What it is and how it replaces a loop[/url] Jeff Moden[/url]

  • RE: Recursive CTE

    Edit: Moved here.


    [font="Arial"]Low-hanging fruit picker and defender of the moggies[/font]

    For better assistance in answering your questions, please read this[/url].


    Understanding and using APPLY, (I)[/url] and (II)[/url] Paul White[/url]

    Hidden RBAR: Triangular Joins[/url] / The "Numbers" or "Tally" Table: What it is and how it replaces a loop[/url] Jeff Moden[/url]

  • RE: Adding rows od data together

    -- Create some sample data

    DROP TABLE #Temp

    CREATE TABLE #Temp (Name VARCHAR(5), Attendances INT, Did_Not_Attends INT)

    INSERT INTO #Temp (Name, Attendances, Did_Not_Attends)

    SELECT 'North', 1, 2 UNION ALL

    SELECT 'North', 2, 3 UNION...


    [font="Arial"]Low-hanging fruit picker and defender of the moggies[/font]

    For better assistance in answering your questions, please read this[/url].


    Understanding and using APPLY, (I)[/url] and (II)[/url] Paul White[/url]

    Hidden RBAR: Triangular Joins[/url] / The "Numbers" or "Tally" Table: What it is and how it replaces a loop[/url] Jeff Moden[/url]

  • RE: Inserting into an associative table

    martintalero (4/26/2011)


    The following code worked for me.

    /* INSERTs companyid and industryid INTO INDUSTRYASS table */

    INSERT INTO IndustryAss (CompanyId, IndustryId)

    SELECT DISTINCT dbo.company.CompanyId, dbo.industry.IndustryId

    FROM Company, Industry, dbo.source

    WHERE dbo.source.company=dbo.Company.CompanyName and dbo.source.Industry=dbo.industry.IndustryName

    GO

    Here's the old...


    [font="Arial"]Low-hanging fruit picker and defender of the moggies[/font]

    For better assistance in answering your questions, please read this[/url].


    Understanding and using APPLY, (I)[/url] and (II)[/url] Paul White[/url]

    Hidden RBAR: Triangular Joins[/url] / The "Numbers" or "Tally" Table: What it is and how it replaces a loop[/url] Jeff Moden[/url]

  • RE: Inserting into an associative table

    martintalero (4/26/2011)


    Thanks guys it worked.

    Martin, please can you post the code which works? This gives useful feedback to those who have responded to your request for assistance, and may also...


    [font="Arial"]Low-hanging fruit picker and defender of the moggies[/font]

    For better assistance in answering your questions, please read this[/url].


    Understanding and using APPLY, (I)[/url] and (II)[/url] Paul White[/url]

    Hidden RBAR: Triangular Joins[/url] / The "Numbers" or "Tally" Table: What it is and how it replaces a loop[/url] Jeff Moden[/url]

  • RE: Are the posted questions getting worse?

    LutzM (4/26/2011)


    bitbucket-25253 (4/26/2011)


    GilaMonster (4/26/2011)


    I don't do epic verse.

    Though... (read attached at your own risk, very amateur attempt)

    I take exception to the words "very amateur". Read both and thoroughly enjoyed...


    [font="Arial"]Low-hanging fruit picker and defender of the moggies[/font]

    For better assistance in answering your questions, please read this[/url].


    Understanding and using APPLY, (I)[/url] and (II)[/url] Paul White[/url]

    Hidden RBAR: Triangular Joins[/url] / The "Numbers" or "Tally" Table: What it is and how it replaces a loop[/url] Jeff Moden[/url]

  • RE: Are the posted questions getting worse?

    Grant Fritchey (4/26/2011)


    ChrisM@home (4/26/2011)


    Is it me, or are the posted questions from developers working on medical systems a little worrying?

    I used to work for a medical software company. it was...


    [font="Arial"]Low-hanging fruit picker and defender of the moggies[/font]

    For better assistance in answering your questions, please read this[/url].


    Understanding and using APPLY, (I)[/url] and (II)[/url] Paul White[/url]

    Hidden RBAR: Triangular Joins[/url] / The "Numbers" or "Tally" Table: What it is and how it replaces a loop[/url] Jeff Moden[/url]

  • RE: Are the posted questions getting worse?

    Is it me, or are the posted questions from developers working on medical systems a little worrying?


    [font="Arial"]Low-hanging fruit picker and defender of the moggies[/font]

    For better assistance in answering your questions, please read this[/url].


    Understanding and using APPLY, (I)[/url] and (II)[/url] Paul White[/url]

    Hidden RBAR: Triangular Joins[/url] / The "Numbers" or "Tally" Table: What it is and how it replaces a loop[/url] Jeff Moden[/url]

  • RE: Help with (easy for you) query

    krypto69 (4/26/2011)


    The original query works fine -

    This statement -

    select distinct glaccount, 'ACCOUNT NOT FOUND' ErrorReason

    from dynamicsgp_utilities.dbo.V_sfvouchers

    where (sfid like 'EM-%' or sfid like 'EXP-REP%') and sfid not in

    (

    select pordnmbr...


    [font="Arial"]Low-hanging fruit picker and defender of the moggies[/font]

    For better assistance in answering your questions, please read this[/url].


    Understanding and using APPLY, (I)[/url] and (II)[/url] Paul White[/url]

    Hidden RBAR: Triangular Joins[/url] / The "Numbers" or "Tally" Table: What it is and how it replaces a loop[/url] Jeff Moden[/url]

Viewing 15 posts - 871 through 885 (of 1,228 total)