Forum Replies Created

Viewing 15 posts - 4,171 through 4,185 (of 10,144 total)

  • RE: Help required for performance tuning a view

    What other columns do you need from this table?

  • RE: How to update Flag based on Maximum Amount

    Stefan_G (8/12/2013)


    avdhut.k (8/12/2013)


    Hi,

    I mean Now rest of the things are correct in my requirement,

    Now, In case where for two records, if ...

  • RE: SQL to do calc on different rows

    SELECT

    tr.*,

    ISNULL(nr.c2 - tr.c2,0)

    FROM #t1 tr

    OUTER APPLY (

    SELECT TOP 1 *

    FROM #t1 ti

    WHERE ti.c1 > tr.c1

    ORDER BY ti.c1 ASC

    ) nr

  • RE: Is overpunch amenable to cross apply?

    SELECT

    NDCNumber,

    IngredientCost = CAST(CASE

    WHEN Trailer IN ('{','A','B','C','D','E','F','G','H','I')

    THEN LEFT(ingredientcost,LEN(ingredientcost)-1) + CAST(CHARINDEX('{','{ABCDEFGHI')-1 AS VARCHAR(1))

    WHEN Trailer IN ('J','K','L','M','N','O','P','Q','R','}')

    THEN '-' + LEFT(ingredientcost,LEN(ingredientcost)-1) + '1'

    END AS MONEY)/100

    FROM ...

  • RE: Help required for performance tuning a view

    Can you post the actual plan please Mike? There may well be scope for improving the index.

  • RE: Need Rank function to filter the records

    I'd guess you have used a recursive cte to generate this data. It would help if you were to post the rCTE query and perhaps some sample data to run...

  • RE: select only some rows and then the rest

    What do you mean by "in the exact order"? If the first three rows are nominated by a particular order then it would be more efficient to return the remaining...

  • RE: Help required for performance tuning a view

    The main query filters on trans_class and posted, the subquery doesn't, which would make using ROW_NUMBER quite tricky.

    I'd go for a new (covering) index to support the subquery, something...

  • RE: How to alternate between two values in a column?

    DECLARE @Outstanding DECIMAL(10,2) = 2333.12

    ;WITH Tens AS (SELECT n = 0 FROM (VALUES (0),(0),(0),(0),(0),(0),(0),(0),(0),(0)) t (n)),

    iTally AS (SELECT n = 0 FROM Tens a, Tens b, Tens c, Tens...

  • RE: Reason for dropping TEXT, IMAGE data types

    T.Ashish (8/12/2013)


    declare @image1image

    declare @text1text

    declare @ntext1ntext

    declare @varchar2varchar

    declare @nvarchar2nvarchar

    declare @varbinary2varbinary

    declare @varchar1varchar(max)

    declare @nvarchar1nvarchar(max)

    declare @varbinary1varbinary(max)

    First three variable declarations are definitely going to produce an error.

    Yes of course they will. But this won't:

    declare @image1varbinary(max)

    declare @text1varchar(max)

    declare...

  • RE: Reason for dropping TEXT, IMAGE data types

    T.Ashish (8/11/2013)


    Text, Ntext, and Image data types are invalid for local variables.

    Gosh, where did you read that?

  • RE: How to update Flag based on Maximum Amount

    It might be easier for us to understand if you can describe how the result set from my query is different to what you want.

  • RE: Are the posted questions getting worse?

    Jeff Moden (8/10/2013)


    Brandie Tarvin (8/2/2013)


    How many people (besides Jeff and myself) have written SQL Spackle articles?

    How many SQL Spackle articles are there?

    Yes, I have a reason for asking. But I...

  • RE: Are the posted questions getting worse?

    Stefan Krzywicki (8/9/2013)


    L' Eomot Inversé (8/9/2013)


    ChrisM@Work (8/9/2013)


    dwain.c (8/9/2013)


    ChrisM@Work (8/9/2013)


    Port Moresby - ranked 139th of 140 cities for liveability, whatever that means. I wonder which city came last? What's the grub...

  • RE: Are the posted questions getting worse?

    L' Eomot Inversé (8/9/2013)


    ChrisM@Work (8/9/2013)


    dwain.c (8/9/2013)


    ChrisM@Work (8/9/2013)


    Port Moresby - ranked 139th of 140 cities for liveability, whatever that means. I wonder which city came last? What's the grub like?

    Food's OK....

Viewing 15 posts - 4,171 through 4,185 (of 10,144 total)