Forum Replies Created

Viewing 15 posts - 1,981 through 1,995 (of 10,144 total)

  • RE: CASE WHEN SELECT Help.

    dramaqueen (10/29/2015)


    Hi ChrisM@Work.

    I am still getting the error

    Msg 8114, Level 16, State 5, Line 1

    Error converting data type varchar to float.

    The data in A.Value is a VARCHAR and contains Y,...

  • RE: CASE WHEN SELECT Help.

    Is this what you mean?

    SELECT

    M.[Description]

    ,A.*

    ,M.Threshold

    ,M.[Threshold Direction]

    ,CASE

    WHEN A.[Measure] IN ('RTT-01','RTT-04','RTT-07') AND A.Value > M.Threshold THEN 'LimeGreen'

    WHEN A.[Measure] IN ('RTT-01','RTT-04','RTT-07') THEN 'Red'

    WHEN A.[Measure] IN ('N2F-03') AND A.Value < M.Threshold...

  • RE: Are the posted questions getting worse?

    Koen Verbeeck (10/27/2015)


    ...

    Happy birthday geezer. It's beer O'clock 🙂

  • RE: In Query - All rows with same status

    chindilog (10/28/2015)


    I get it. All rows shows marked but column name shows "constant", how do I change "constant" to "status"?

    SELECT 'Packed', so.num AS ordernum, so.customercontact,

    so.dateissued, so.datecreated, so.datecompleted

    FROM ship

    LEFT JOIN...

  • RE: In Query - All rows with same status

    chindilog (10/28/2015)


    Hello Everyone. This might be very simple, but need some help. I get records from a query whose status is "Marked". I need another column to be added to...

  • RE: CASE WHEN

    dramaqueen (10/28/2015)


    Hello,

    Me again really sorry.

    I am trying to script a case when to achieve the following.

    I have a table of measures with certain threshold. The threshold direction can either be...

  • RE: where clause help

    Sean Lange (10/28/2015)


    kat35601 (10/28/2015)


    ...

    ....

    Then you have inequality conditions in you where clause. This is nonSARGable and prevents index seeks.

    ...

    Not always:

    CREATE TABLE #MyTable (ID INT IDENTITY(1,1) NOT NULL, Inequality CHAR(1))

    INSERT...

  • RE: where clause help

    -- is wm.lastupdate a datetime?

    SELECT *

    FROM WIP_master wm

    LEFT JOIN m1_DC.dbo.SalesOrders so

    ON so.ompSalesOrderID = wm.ompSalesOrderID

    LEFT JOIN m1_DC.dbo.UTRUCK t

    ON t.UTRTRUCKNUMBER = so.UOMPTRUCKNUMBER

    WHERE (redtag='Y' OR so.uompschedulenumber LIKE 'S%')

    AND so.ompclosed <>...

  • RE: Optimizer Building different Execution plans

    jody.a.morgan (10/28/2015)


    If I select the "Select" in the Execution plans and click properties the "Reason for Early Termination of Statement Optimization" is "Time Out"

    The query is too complex for SQL...

  • RE: Optimizer Building different Execution plans

    The queries are the same to you but they are different queries to SQL Server, hence different execution plans.

    Right-click on the leftmost operator - the SELECT - and examine the...

  • RE: Building a tree view using t-sql

    /*

    DROP TABLE #TREE

    create table #tree (Position VARCHAR(10), level int, seq int, value varchar(200))

    insert into #tree

    select '1', 2,2,'Earth' union all

    select '1.1', 3,3,'Europe' union all

    select '1.1.1', 4,4,'France' union all

    select '1.1.2', 4,5,'Germany' union...

  • RE: Date Function (Possibility)

    SQLPain (10/27/2015)


    Thanks Scott, I am using the GroupBy and having clause but using them is not making any difference as results are coming out to be exact same. Funny thing...

  • RE: SUM Case When (decimal's!)

    dramaqueen (10/27/2015)


    Here is the design view of the audit table. I am putting the data into the value field.

    Can you post the code?

  • RE: SUM Case When (decimal's!)

    dramaqueen (10/27/2015)


    Hi,

    Can someone please explain why this is happening.

    I am using a select query to do the following;

    SUM(CASE WHEN [Measure] = 'XXX' THEN 1 ELSE 0 END) AS 'SEN-04'

    The numbers...

  • RE: Scripting a query that needs all values.

    This type of problem has a name - Relational Division - and a number of solutions. This is the simplest solution:

    CREATE TABLE #ItemsMap (TagID INT, ItemID INT)

    INSERT INTO #ItemsMap (TagID,ItemID)...

Viewing 15 posts - 1,981 through 1,995 (of 10,144 total)