Forum Replies Created

Viewing 15 posts - 1,231 through 1,245 (of 1,468 total)

  • RE: Determine average

    crowegreg - Monday, March 27, 2017 4:05 PM

    That works great. I only have 1 change. I need the average of the sum...

  • RE: fill factor with clustered PK on identity PLUS another column

    Indianrock - Monday, March 27, 2017 2:58 PM

    Most of our tables have a clustered PK on an integer identity column.   These...

  • RE: Determine average

    crowegreg - Monday, March 27, 2017 2:24 PM

    Here is my sample data:
    fy year    month name    report week    end date    outage_hr_decimal_calc    remedy alg
    FY17    Mar    Mar 24th    2017-03-17 08:23:00    1.33    Critical
    FY17    Mar    Mar 24th    2017-03-17 09:00:00    0.40    High
    FY17    Mar    Mar 24th    2017-03-17...

  • RE: Issue with Patindex

    mcfarlandparkway - Monday, March 27, 2017 7:43 AM

    Right now the data is showing as

    --00000000
    --02005523

    So with the patindex is there a way...

  • RE: sys.dm_exec_query_stats

    Well, the documentation states that these new columns were added from SQL 2016.  However, they are available in my SQL 2014 instance.


    SELECT @@VERSION;

  • RE: keeping the records into exception

    mcfarlandparkway - Thursday, March 23, 2017 2:29 PM

    In the same way can I use delte from exception and again inserting into std...

  • RE: keeping the records into exception

    You could achieve this with a MERGE statement.
    There is no need for an explicit transaction, as it is one one statement that will succeed or rollback as a whole.

  • RE: Renumbering key column in SELECT query

    Zidar - Thursday, March 23, 2017 12:19 PM

    I would expect Rank or Dense_Rank to work, but they don't :unsure:. This is...

  • RE: Pivot - what is wrong with this query?

    The query works.

    What is your expected outcome?

  • RE: SQL to display hourly count including zero

    The format of your query appears to ba MySQL format.

    In T-SQL, we can do it like this ...

    Create some sample data

    CREATE TABLE...

  • RE: SQL to display hourly count including zero

    Please provide us with CREATE TABLE scripts for the 2 tables, as well as INSERT statements with sample data, and the expected results.

  • RE: Primary key violation on INSERT, even though TABLOCKX is held

    Although off topic, in SQL 2008 the query optomiser always assumes 1 record in @staging_table_var.  This is because SQL does not maintain stats for @Table variables.

    If you change to...

  • RE: Help with SQL Query

    You could try to get the Primary number first ...

    WITH ctePhoneNumber AS (
    SELECT
      pn.PersonID,
      pn.PhoneNumber,
      rn =...

  • RE: help with the query

    Firstly, start off by using Jeff Moden's Tally function

    CREATE FUNCTION [dbo].[fnTally]
    /**********************************************************************************************************************
    Purpose:
    Return a column of BIGINTs from @ZeroOrOne up to and including...

  • RE: Windows Functions: Tell me when that changes.

    You can also provide a Default value for the LEAD/LAG Window functions.

    In this case, it means not having to add the extra AND PREVIOUS_CODE IS NOT NULL in the...

Viewing 15 posts - 1,231 through 1,245 (of 1,468 total)