Forum Replies Created

Viewing 15 posts - 106 through 120 (of 5,502 total)

  • RE: How to replace null value in a query

    New_2SQL (8/10/2014)


    Hi Jeff Moden,

    This was a test run on about 88 rows as you can see in the source code posted above.

    During production rows will grow in millions.

    If production conditions...



    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: Passing multiple columns values from SQL query to one variable

    One way to assign more than one value to a variable is to use a table variable.

    But the major issue with your code is slightly different: you're using the very...



    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: Are the posted questions getting worse?

    Is it as annoying for you as it is for me to see all those spam posts?

    Today (Sunday, August 10th), 22 out of 36 posts were plain spam. All from...



    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: T-SQL QUERY - NOT ABLE TO PASS VALUE TO A VARIABLE

    Both of your SLEECT statements between parenthesis ar missing the table alias at the end.

    E.g.

    SELECT @EMP_ID = ID FROM (SELECT ID, ROW_NUMBER() OVER (ORDER BY ID ASC) ROW_NUM FROM dbO.TD_EmployeeProfile_FinalV2)...



    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: T-SQL QUERY - NOT ABLE TO PASS VALUE TO A VARIABLE

    You can't reference a table with a variable unless you use dynamic SQL.

    SELECT EMAIL_ADDR, ID FROM (@TABLE_NAME) won't work.

    Since the value dbO.TD_EmployeeProfile_FinalV2 is assigned directly, whydon't you use it 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]

  • RE: Query Result for sequential range

    Here's a slightly different approach:

    create table #x (col1 int)

    insert into #x

    values

    (202),(203),(204),(205),(209),(210),(211),(309),

    (310),(311),(312),(313),(314);

    WITH cte as

    (

    SELECT col1, ROW_NUMBER() OVER (ORDER BY col1) as id, col1 - ROW_NUMBER() OVER (ORDER BY col1) as...



    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 base design for workflow

    I would add a Conditions table with the columns Condition, Step, NextStep.

    In that table I'd store all the options for a specific Condition.

    For example, Condition "A" can go from Step...



    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: User Defined Function - using table name as variable

    Are the row count values in sys.partitions accurate in general or is there a SQL Server version where the data started being "reliable" rather than "approximate"?



    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: User Defined Function - using table name as variable

    GilaMonster (8/10/2014)


    LutzM (8/10/2014)


    Quote from BOL(SS2K14):

    rows (bigint): Indicates the approximate number of rows in this partition.

    The value from sys.partitions is accurate, with the exception of a bug in SQL.

    So, BOL is...



    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: User Defined Function - using table name as variable

    Quote from BOL(SS2K14):

    rows (bigint): Indicates the approximate number of rows in this partition.



    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: User Defined Function - using table name as variable

    I'd like to change Eirikurs 2nd method just slightly to cover partitioned tables, too:

    CREATE FUNCTION dbo.FN_COUNT_ROWS2

    (

    @TABLE_NAME NVARCHAR(128)

    )

    RETURNS TABLE

    AS

    RETURN

    SELECT SUM(rows) AS ROW_COUNT FROM sys.partitions

    WHERE object_id =...



    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: advice for questions to ask regarding new database for 3rd party application

    I'd like to know about the concept of the app accessing data.

    Is it through queries constructed at the app side? (including DML statements)?

    Is there any "Wannabe-Converter" (like NHyperhate) involved?

    How much...



    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: Troubleshooting\Tuning sql query taking more than 40 secs

    You've mentioned to expect between 10 and 50 rows as the result set.

    However, the actual execution plan returned more than 280.000 rows.

    Are those rows really returned?

    Or is there usually a...



    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: Handle Null values useing update statment in sql server

    MERGE is overkill here, I'd say.

    You could use something along those lines:

    UPDATE TableB

    SET Descr = ISNULL(TableA.Descr ,'NA'), Name = CASE WHEN TableA.id IS NULL THEN TableA.Name ELSE TableB.Name END

    FROM TableB

    LEFT...



    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: Troubleshooting\Tuning sql query taking more than 40 secs

    The reason I'm asking is fairly simple:

    Based on the estimated execution plan there's nothing to indicate the long duration.

    A few things can still be improved:

    It seems like there are a...



    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 - 106 through 120 (of 5,502 total)