Forum Replies Created

Viewing 15 posts - 3,361 through 3,375 (of 5,502 total)

  • RE: Duplicate Record

    Would you please clarify what you're trying to do?

    Will you either end up without duplicates or do you want to insert duplicate values?

    If the former, follow Pablos advice. If the...



    Lutz
    A pessimist is an optimist with experience.

    How to get fast answers to your question[/url]
    How to post performance related questions[/url]
    Links for Tally Table [/url] , Cross Tabs [/url] and Dynamic Cross Tabs [/url], Delimited Split Function[/url]

  • RE: Collapsing a Table

    Did you compare the performance of your solution vs. the other three methods posted so far?



    Lutz
    A pessimist is an optimist with experience.

    How to get fast answers to your question[/url]
    How to post performance related questions[/url]
    Links for Tally Table [/url] , Cross Tabs [/url] and Dynamic Cross Tabs [/url], Delimited Split Function[/url]

  • RE: Primary Keys and FKeys

    To add an "it depends" opinion:

    I've read that there are cases when a PK-FK relation will help the query analyzer to come up with a more efficient plan. No sample...



    Lutz
    A pessimist is an optimist with experience.

    How to get fast answers to your question[/url]
    How to post performance related questions[/url]
    Links for Tally Table [/url] , Cross Tabs [/url] and Dynamic Cross Tabs [/url], Delimited Split Function[/url]

  • RE: need help with doing a sum and selecting records

    Please provide table def and sample data in a ready to use format so we can focus on providing a tested solution instead of formatting the sample data.

    Furthermore, please include...



    Lutz
    A pessimist is an optimist with experience.

    How to get fast answers to your question[/url]
    How to post performance related questions[/url]
    Links for Tally Table [/url] , Cross Tabs [/url] and Dynamic Cross Tabs [/url], Delimited Split Function[/url]

  • RE: how to show Output in single row.

    Please provide table def, sample data and expected result in a ready to use format as described in the first link in my signature. Also. please provide what you've tried...



    Lutz
    A pessimist is an optimist with experience.

    How to get fast answers to your question[/url]
    How to post performance related questions[/url]
    Links for Tally Table [/url] , Cross Tabs [/url] and Dynamic Cross Tabs [/url], Delimited Split Function[/url]

  • RE: Randomizing some data

    Disclaimer: I never had to do it, so my attempt might not really be a good solution...

    Here's how I'd do it:

    Assuming sample data like you provided I would generate two...



    Lutz
    A pessimist is an optimist with experience.

    How to get fast answers to your question[/url]
    How to post performance related questions[/url]
    Links for Tally Table [/url] , Cross Tabs [/url] and Dynamic Cross Tabs [/url], Delimited Split Function[/url]

  • RE: Get the result of TOP N from a Flat file

    You could use bcp with -L option(last row).

    Set the field terminator to a non-existing character in that file (e.g. ~ or °) and import it into a table with only...



    Lutz
    A pessimist is an optimist with experience.

    How to get fast answers to your question[/url]
    How to post performance related questions[/url]
    Links for Tally Table [/url] , Cross Tabs [/url] and Dynamic Cross Tabs [/url], Delimited Split Function[/url]

  • RE: nvarchar(max) truncated

    You should rethink the general structure of your query.

    Instead of using repeating queries with all but one parameter being equal you should look into CASE WHEN instead.

    Example:

    --instead of

    SELECT

    CAST(''Novembre''...



    Lutz
    A pessimist is an optimist with experience.

    How to get fast answers to your question[/url]
    How to post performance related questions[/url]
    Links for Tally Table [/url] , Cross Tabs [/url] and Dynamic Cross Tabs [/url], Delimited Split Function[/url]

  • RE: Reading .TXT File

    To get the data into SQL server, look into bcp or OPENROWSET, maybe even linked server (depends on the -unknown- scenario).

    You could use CHARINDEX() and LEFT/RIGHT/STUFF to separate the two...



    Lutz
    A pessimist is an optimist with experience.

    How to get fast answers to your question[/url]
    How to post performance related questions[/url]
    Links for Tally Table [/url] , Cross Tabs [/url] and Dynamic Cross Tabs [/url], Delimited Split Function[/url]

  • RE: TSQL Help: Display Row for 1 week on certain conditions, then roll off?

    I don't think you would violate any rules if you would provide a table structure with fake table and column names and fake data and fake results based on those...



    Lutz
    A pessimist is an optimist with experience.

    How to get fast answers to your question[/url]
    How to post performance related questions[/url]
    Links for Tally Table [/url] , Cross Tabs [/url] and Dynamic Cross Tabs [/url], Delimited Split Function[/url]

  • RE: TSQL Help: Display Row for 1 week on certain conditions, then roll off?

    If you would provide table def for the tables involved, some sample data to work with and your expected result we might be able to provide you with a tested...



    Lutz
    A pessimist is an optimist with experience.

    How to get fast answers to your question[/url]
    How to post performance related questions[/url]
    Links for Tally Table [/url] , Cross Tabs [/url] and Dynamic Cross Tabs [/url], Delimited Split Function[/url]

  • RE: Data type for a column with a decimal

    I still would use NUMERIC(?,1).

    Assume two version numbers: 10.1 and 4.1.

    Try to select the max. version number...

    DECLARE @tbl TABLE

    (

    num NUMERIC(4,1),

    stri VARCHAR(4)

    )

    INSERT INTO @tbl

    SELECT 4.1,...



    Lutz
    A pessimist is an optimist with experience.

    How to get fast answers to your question[/url]
    How to post performance related questions[/url]
    Links for Tally Table [/url] , Cross Tabs [/url] and Dynamic Cross Tabs [/url], Delimited Split Function[/url]

  • RE: How to group consecutive months

    I don't understand the question...

    The UNION ALL is used to populate the sample table @tbl with the (unformatted) data you provided.

    Basically, you could use the query after the semicolon. Just...



    Lutz
    A pessimist is an optimist with experience.

    How to get fast answers to your question[/url]
    How to post performance related questions[/url]
    Links for Tally Table [/url] , Cross Tabs [/url] and Dynamic Cross Tabs [/url], Delimited Split Function[/url]

  • RE: How to group consecutive months

    Would the following code snippet help you to get started?

    DECLARE @tbl TABLE(account_number CHAR(8),payment_amt DECIMAL(6,2),DATE_PAYMENT_DUE DATETIME, num INT)

    INSERT INTO @tbl

    SELECT '10043997', 379.28 ,'2009-11-01 00:00:00.000', 1 UNION ALL

    SELECT '10043997', 379.28 ,'2009-12-01 00:00:00.000',...



    Lutz
    A pessimist is an optimist with experience.

    How to get fast answers to your question[/url]
    How to post performance related questions[/url]
    Links for Tally Table [/url] , Cross Tabs [/url] and Dynamic Cross Tabs [/url], Delimited Split Function[/url]

  • RE: Help with Ranking Functions

    divyanth (6/2/2010)


    using a CTE instead of a sub query would improve the performance of the query

    ...

    AFAIK this is actually not true, since both, CTE and subquery will result in...



    Lutz
    A pessimist is an optimist with experience.

    How to get fast answers to your question[/url]
    How to post performance related questions[/url]
    Links for Tally Table [/url] , Cross Tabs [/url] and Dynamic Cross Tabs [/url], Delimited Split Function[/url]

Viewing 15 posts - 3,361 through 3,375 (of 5,502 total)