Forum Replies Created

Viewing 15 posts - 1,171 through 1,185 (of 3,544 total)

  • RE: Condition in Where clause query

    What is the definition of the input parameter?

    At a guess

    If input parameter TRADE is singular then

    CASE WHEN MG_BOOKING.TRADE IS NULL THEN CASE WHEN MG_BILL.TRADE = @TRADE THEN 1

    ...

    Far away is close at hand in the images of elsewhere.
    Anon.

  • RE: Grouping and crosstab like behaviour.... hairy query

    My solution for what it's worth 😉

    SELECTIDENTITY(INT,1,1) AS [RowNum],

    PartNumber,

    Factor

    INTO#MyHead

    FROMdbo.XlsDump

    ORDER BY PartNumber, Factor

    SELECT IDENTITY(INT,0,1) AS [GroupNumber],0 AS [RowNum]

    INTO #MyHead2

    INSERT #MyHead2 (RowNum)

    SELECT a.RowNum

    FROM #MyHead a

    LEFT JOIN #MyHead n ON n.RowNum=a.RowNum+1

    WHERE NOT (a.Factor=n.Factor)

    OR...

    Far away is close at hand in the images of elsewhere.
    Anon.

  • RE: Are the posted questions getting worse?

    SQLkiwi (3/7/2011)


    Gianluca Sartori (3/7/2011)


    SQLkiwi (3/4/2011)


    Exciting day - just had my first Simple Talk article published:

    http://www.simple-talk.com/sql/learn-sql-server/understanding-and-using-parallelism-in-sql-server/

    Great job, Paul! Outstanding, as usual.

    Now there's a chance that a poor n00b like me can...

    Far away is close at hand in the images of elsewhere.
    Anon.

  • RE: Are the posted questions getting worse?

    Ian Scarlett (2/24/2011)


    SQLkiwi (2/24/2011)


    David Benoit (2/24/2011)


    I remember when I took my first programming class, Pascal (Turbo actually)...

    I did a term using Turbo Pascal at University too.

    OMG, that makes me feel...

    Far away is close at hand in the images of elsewhere.
    Anon.

  • RE: Today's Random Word!

    oecus

    Far away is close at hand in the images of elsewhere.
    Anon.

  • RE: SQLSERVER 2000 SQL UNION

    GSquared (2/18/2011)


    David Burrows (2/18/2011)


    string strsql = "";

    strsql += " Select '' AS [CustomerId],' ---Select Customer --- ' AS [CompanyName] ";

    strsql += " Union Select CustomerId, CompanyName ";

    strsql +=...

    Far away is close at hand in the images of elsewhere.
    Anon.

  • RE: Are the posted questions getting worse?

    Gianluca Sartori (2/18/2011)


    I have to admit it was my fault.

    If I didn't post on THE THREAD a "Lennie alert" nobody would have noticed, Lennie would have got his answer and...

    Far away is close at hand in the images of elsewhere.
    Anon.

  • RE: SQLSERVER 2000 SQL UNION

    string strsql = "";

    strsql += " Select '' AS [CustomerId],' ---Select Customer --- ' AS [CompanyName] ";

    strsql += " Union Select CustomerId, CompanyName ";

    strsql += " From testCustomers...

    Far away is close at hand in the images of elsewhere.
    Anon.

  • RE: why the avatar picture you use

    Mine says it all :w00t:

    Far away is close at hand in the images of elsewhere.
    Anon.

  • RE: how to display previous month data along with current month data

    Or even this

    SELECT RegionName,

    AVG(CASE WHEN Month_Value = 7 THEN Answer END) AS [PreviousMonthAns],

    AVG(CASE WHEN Month_Value = 8 THEN Answer END) AS [Answer]

    FROM Mst_Location A

    JOIN Voc_Trans_Details D...

    Far away is close at hand in the images of elsewhere.
    Anon.

  • RE: how to display previous month data along with current month data

    This probably better than the join

    SELECT RegionName,

    CASE WHEN Month_Value = 7 THEN Answer END AS [PreviousMonthAns],

    CASE WHEN Month_Value = 8 THEN Answer END AS [Answer]

    FROM x

    GROUP...

    Far away is close at hand in the images of elsewhere.
    Anon.

  • RE: how to display previous month data along with current month data

    WITH x (RegionName, Month_Value, Answer) AS (

    SELECT B.RegionName, D.Month_Value, AVG(D.Answer) AS [Answer]

    FROM Mst_Location A

    JOIN Voc_Trans_Details D ON A.LocationID = D.Location_Id

    JOIN Master_Map_RegionWithLocation C ON A.LocationID = C.LocationID

    JOIN...

    Far away is close at hand in the images of elsewhere.
    Anon.

  • RE: Surely there is a way to import CSV data in this situation?

    My query had a problem and for the record I post a revised version

    Based on a million rows of my test data

    '1,2,3,"abc,def",4,5,"ghi,jkl",6,7,"8,"""",x,y"""",",9'

    on my desktop, it took 7 iterations taking...

    Far away is close at hand in the images of elsewhere.
    Anon.

  • RE: Surely there is a way to import CSV data in this situation?

    This solution uses a temp table to add a unique id to the data

    It needs to be repeated until no updates are left

    (sorry about the short names but it was...

    Far away is close at hand in the images of elsewhere.
    Anon.

  • RE: Surely there is a way to import CSV data in this situation?

    Craig Farrell (1/24/2011)


    Try swapping:

    PatIndex('%"%,%"%',THE_LINE)),

    -- with this:

    PatIndex('%,"%,%",%',THE_LINE)),

    Note where the additional commas are to detect beginning and ending doublequotes.

    I may have an alternative for you but it's going to be a busy...

    Far away is close at hand in the images of elsewhere.
    Anon.

Viewing 15 posts - 1,171 through 1,185 (of 3,544 total)