Forum Replies Created

Viewing 15 posts - 3,721 through 3,735 (of 10,144 total)

  • RE: Optimize Update Statement

    IgorMi, you can use http://extras.sqlservercentral.com/prettifier/prettifier.aspx.

    I tend not to. If I'm about to spend a few minutes reading and understanding a chunk of code, reformatting it easily becomes part of the...

  • RE: Cursor and update

    phineas629 (1/24/2014)


    ... I am required to use the cursor...

    Perfectly reasonable so long as this is homework. If not, then do it properly:

    UPDATE Outlet.tblProductMaster SET

    Product_Status = CASE

    WHEN Seller_No = @strSellerNo1...

  • RE: Optimize Update Statement

    If you're wondering what the variables are for in the UPDATE, they collect some column values as they are before any updates have been performed:

    DROP TABLE #EXPORTMAIN

    CREATE TABLE #EXPORTMAIN (

    ID...

  • RE: Optimize Update Statement

    Same statement rewritten as UPDATE FROM, with nonsense logic commented out:

    -- Formatted

    DECLARE @tempS AS nvarchar(150)

    DECLARE @tempW AS nvarchar(50)

    DECLARE @tempQ As nvarchar(5)

    UPDATE e SET

    @tempS = SKU1, --...

  • RE: Optimize Update Statement

    Formatted for readability:

    -- Formatted

    DECLARE @tempS AS nvarchar(150)

    DECLARE @tempW AS nvarchar(50)

    DECLARE @tempQ As nvarchar(5)

    UPDATE dbo.EXPORTMAIN SET

    @tempS = SKU1,

    @tempW = WHSELOC1,

    @tempQ = QTY1,

    SKU1 = Case

    When...

  • RE: Rank over with Clustered Index

    lianvh 89542 (1/23/2014)


    Thank you for the feedback. I am sorry for expressing myself incorrectly. Business wanted the data on screen more precisely ordered. It was up to Dev and the...

  • RE: Rank over with Clustered Index

    lianvh 89542 (1/23/2014)


    Thank you for the feedback. There was a business requirement for the concatenated clustered index . The rank over was then needed to order the rows more accurately...

  • RE: How to display minimum values only in table?

    Prassad Dabbada V R (1/21/2014)


    Write CTE

    check below link for example on CTE

    http://www.codeproject.com/Articles/265371/Common-Table-Expressions-CTE-in-SQL-SERVER-2008

    The examples are fine but the author of the article clearly knows little about CTE's and slips on a...

  • RE: Help needed to Process Optimization

    Before considering esoteric wait stats and such, your code would benefit from an overhaul to bring your join syntax up to date. Your first query equates to this:

    UPDATE pro SET...

  • RE: how to avoid sub queries and FUNCTIONS in where clause ?

    kbhanu15 (1/22/2014)


    HI Thanks for your reply but the given query is present in a view

    i think it wont work in views?

    view details:

    create view Screen_RatingsData_ProbabilityOfDefault_vw

    as

    select...

  • RE: how to avoid sub queries and FUNCTIONS in where clause ?

    kbhanu15 (1/22/2014)


    HI ,

    the below query taking 5 minutes time, i want to rewrite this query ?

    query details :

    select pd.companyId, asOfDate as scoreDate, Convert(numeric(38,10),pd.PDValue) * 100 as zscore

    from pdDataMarketSignal_vw...

  • RE: How to optimize case statement

    Like Gail, I don't think this expression is going to have much impact on performance. Maintainability is another story - updating n queries to account for product changes leaves you...

  • RE: Replacing recurring characters in a string with single character

    mickyT (1/21/2014)


    ChrisM@Work (1/21/2014)


    Couple of small changes to MickeyT's otherwise excellent function:

    Thanks Chris, I missed that I had messed up the result. I made some changes for performance to what...

  • RE: Running Total

    Ford Fairlane (1/19/2014)


    Thanks for the heads up Jeff, how would you tackle it then ?

    Start by reducing the noise to see what's going on:

    SELECT

    x.YearMonth,

    [DEPTH] = (

    SELECT

    SUM(b.DEPTH)

    FROM HOLELOCATION b

    CROSS...

  • RE: select latest records

    abhas (1/21/2014)


    Thanks All,

    I am doing the same.

    SELECT

    ROW_NUMBER() OVER (PARTITION BY t.CustomerName ORDER BY t.DateAdded DESC) AS RowNumber

    from tblCustomer. but it is giving 1,2,3.....RowNumber.

    I want again repeat RowNumber to each...

Viewing 15 posts - 3,721 through 3,735 (of 10,144 total)