Forum Replies Created

Viewing 15 posts - 3,376 through 3,390 (of 4,085 total)

  • RE: Update with except conditon

    ChrisM@home (1/4/2012)


    say there are ten rows with the same VND_ID and only one of them matches the filter?

    You'll need to post sample data illustrating the problem and the desired results.

    Drew

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: Update with except conditon

    Actually, why are you using a subquery in the first place. Doesn't the following give you what you want?

    UPDATE PLU_1

    SET DSPL_DESCR = replace ([DSPL_DESCR],'"','in')

    WHERE AND DSPL_DESCR LIKE '%"%'

    AND len(replace...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: Update with except conditon

    The problem is that your REPLACE function is increasing the length of the string beyond the maximum allowed and you haven't correctly accounted for that fact. Given your subquery,...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: Query Question

    This is a presentation issue and is best handled in the presentation layer, not the database layer. You don't mention what you are using for your presentation layer, but...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: Get the delta records between 2 tables with same structure

    Welsh Corgi (12/31/2011)


    @Drew,

    You probably already know this but you can get a SQL Server 2008 R2 Developer Edition for under $50 USD.

    Yes, I already have it installed on my laptop...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: Problem with a simple Scalar UDF

    CELKO (12/30/2011)


    A function or a procedure is names with <verb>_<object> and does not have the meta-data like “udf_”; name things for what they are, not how they are implemented.

    Naming...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: Get the delta records between 2 tables with same structure

    If you just want the differences without updating, the easiest approach is to use the EXCEPT statement.

    SELECT [id], [name], [address], meter_flag, end_date

    FROM TableB

    EXCEPT

    SELECT [id], [name], [address], meter_flag, end_date

    FROM TableA

    This will...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: Get the delta records between 2 tables with same structure

    You're looking for the MERGE statement, which was introduced in SQL 2008. You can find more information in BOL. We still don't have SQL 2008, so I can't...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: How to get the max of records in row_number

    Evil Kraig F (12/29/2011)


    I wouldn't do this with Row_Number

    I would use Row_Number, because using MAX() in a subquery has the possibility of duplicate values if there are multiple records with...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: Format a Percentage

    Welsh Corgi (12/29/2011)


    drew.allen (12/29/2011)


    You realize that this is a presentation issue and is best handled in the presentation layer.

    Drew

    I guess that it depends because you may not always have a...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: Problem with a simple Scalar UDF

    I should mention another advantage of STUFF(). You're not cutting the string into pieces and reassembling them, so you don't have to worry about getting the pieces in the...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: Problem with a simple Scalar UDF

    I prefer using STUFF rather than SUBSTRING and concatenation for a couple of reasons:

    * It's language independent. The substring approach will fail if the language settings don't match...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: top 80 percent from sum

    cometav2011 (12/29/2011)


    I want to get the top 80% of a cumulative sum of a numeric field. Thanks but i have more than 1 mln rows and i am newbees....

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: top 80 percent from sum

    roryp 96873 (12/29/2011)


    If you want to get the top 80% of a cumulative sum of a numeric field, you have to do something like this (assuming you want them ordered...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: Format a Percentage

    You realize that this is a presentation issue and is best handled in the presentation layer.

    Drew

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

Viewing 15 posts - 3,376 through 3,390 (of 4,085 total)