Forum Replies Created

Viewing 15 posts - 6,871 through 6,885 (of 8,731 total)

  • RE: How to show variance in column values

    My crystal ball says this might work:

    SELECT ID,

    PreviousYear_Profit,

    SUM( PreviousYear_Profit) OVER (PARTITION BY (SELECT NULL)) AS PriorVersion ,

    SUM( PreviousYear_Profit) OVER (PARTITION BY (SELECT NULL)) - PreviousYear_Profit AS Variance

    FROM calculate

    This is a...

  • RE: Error message - aggregate function and group by clause

    Without sample data, I guess you need to do something like this:

    SELECTph.CalculatedTotalTime,

    ph.ProdHeaderDossierCode,

    ph.MachGrpCode,

    ph.EmpId,

    pd.PartCode

    FROMdbo.T_ProcessedHour ph

    JOINdbo.T_ProductionHeader pd ON ph.ProdHeaderDossierCode = pd.ProdHeaderDossierCode

    JOINdbo.T_DossierMain dm ON pd.DossierCode = dm.DossierCode

    whereph.RegDate >= '2013-01-01 00:00:00:000' and

    dm.DelDate < getdate() and

    ph.MachGrpCode...

  • RE: Are the posted questions getting worse?

    Ed Wagner (2/19/2014)


    GilaMonster (2/19/2014)


    Welcome to page 2150 🙂

    It's not necessarily the easy questions that we moan about. It's the ones with no thought or no research or the ones that...

  • RE: Simple query failing

    Has anyone played with your batch separator settings?

  • RE: Select a part of text from the xml

    You could use CHARINDEX and SUBSTRING functions like this:

    WITH Samp AS(

    SELECT 'TL43:The product has no marked price.;' AS SomeText

    )

    SELECT LEFT( SomeText, CHARINDEX(':', SomeText) - 1),

    SUBSTRING(SomeText, CHARINDEX(':', SomeText) + 1, CHARINDEX(';',...

  • RE: Issue with Self Join

    You're just too kind :blush:

    I'm just someone who loves to help 🙂

  • RE: Issue with Self Join

    Maybe something like this:

    SELECT MIN(id) id

    FROM sample t1

    WHERE EXISTS(SELECT 1

    FROM sample t2

    WHERE t1.islabel != t2.islabel

    AND t1.mark = t2.mark)

    GROUP BY mark, islabel

    ORDER BY id

    Do you understand how...

  • RE: Remove bad characters from nvarchar column

    I'm not sure what's happening here. Maybe someone else can explain this.

    It seems that you can correct this using a binary collation in the replace.

    with sampledata as (

    SELECT N'Something' +...

  • RE: Issue with Self Join

    This:

    where t1.mark = 0 and t2.mark = 1

    Should be like this:

    WHERE t1.islabel = 0 and t2.islabel = 1

    Is that correct?

  • RE: Time to Retire

    Matt Miller (#4) (2/18/2014)


    Luis Cazares (2/17/2014)


    Or I can marry and move out 😀

    Or marry, move out and transfer all support calls to the spouse 😀

    +10

  • RE: Simple Tsql scenario - Please help

    You could think of CTEs as subqueries that are in a different position or as one-use views.

    To post formatted code, you just have to put it between the code tags...

  • RE: Remove bad characters from nvarchar column

    Are you sure is NCHAR(65533)?

    Here's something you can use to identify it.

    WITH E1(N) AS(

    SELECT N FROM (VALUES(0),(0),(0),(0),(0),(0),(0),(0),(0),(0))e(N)

    ),

    E2(N) AS(

    SELECT a.N FROM E1 a, E1 b

    ),

    E4(N) AS(

    SELECT a.N FROM E2 a, E2...

  • RE: Simple Tsql scenario - Please help

    Just to be sure. Do you understand how it works? Which option did you take?

  • RE: Remove bad characters from nvarchar column

    Could you use REPLACE? Or would that be a problem with your real data?

  • RE: Dumb interview answers

    Sean Lange (2/18/2014)


    OCTom (2/18/2014)


    The following was in 1991 and in response to the question, "How many seminars or classes have you attended to keep up on technology?"

    Answer: "I'm not really...

Viewing 15 posts - 6,871 through 6,885 (of 8,731 total)