Forum Replies Created

Viewing 15 posts - 1,261 through 1,275 (of 2,462 total)

  • RE: How to find the first, last and the Highest (Peak Value) in a list

    ITU_dk2012 (9/17/2015)


    Hi all,

    I have a column in a table which holds list of values. I would like to find the first value, the highest value(Peak Value), and the last value...

    "I cant stress enough the importance of switching from a sequential files mindset to set-based thinking. After you make the switch, you can spend your time tuning and optimizing your queries instead of maintaining lengthy, poor-performing code."

    -- Itzik Ben-Gan 2001

  • RE: Xpath SQL query help please

    Here's what you are looking for:

    WITH

    dataSets AS

    (

    SELECT

    DatasetName = xxx.value('(@Name)[1]','varchar(100)'),

    ParameterDatasetReferenceTxt = xxx.value('(.//*:CommandText/text())[1]','varchar(1000)')

    FROM (VALUES(@XML)) T(X)

    CROSS APPLY X.nodes('//*:DataSet') xxx(xxx)

    ),

    params...

    "I cant stress enough the importance of switching from a sequential files mindset to set-based thinking. After you make the switch, you can spend your time tuning and optimizing your queries instead of maintaining lengthy, poor-performing code."

    -- Itzik Ben-Gan 2001

  • RE: query for compare data in 2 tables

    First, welcome to SQLServerCentral. Please note the link in my signature line for the best way to get help here...

    I don't know exactly what you are looking for but...

    "I cant stress enough the importance of switching from a sequential files mindset to set-based thinking. After you make the switch, you can spend your time tuning and optimizing your queries instead of maintaining lengthy, poor-performing code."

    -- Itzik Ben-Gan 2001

  • RE: Determine size of the database

    Can i get the approximate size by right clicking on database and by using the size property Under Database category to get the size idea?

    if I understand your question correctly....

    "I cant stress enough the importance of switching from a sequential files mindset to set-based thinking. After you make the switch, you can spend your time tuning and optimizing your queries instead of maintaining lengthy, poor-performing code."

    -- Itzik Ben-Gan 2001

  • RE: http://loseweightgarcinianow.com/metabo-matrix/

    Spam reported.

    "I cant stress enough the importance of switching from a sequential files mindset to set-based thinking. After you make the switch, you can spend your time tuning and optimizing your queries instead of maintaining lengthy, poor-performing code."

    -- Itzik Ben-Gan 2001

  • RE: Percentile Calculation

    You need PERCENT_RANK which is not available In SQL 2012.

    To get the Percent Rank Pre-2012:

    If rk is the RANK for the specified partition

    AND rc is the row count for...

    "I cant stress enough the importance of switching from a sequential files mindset to set-based thinking. After you make the switch, you can spend your time tuning and optimizing your queries instead of maintaining lengthy, poor-performing code."

    -- Itzik Ben-Gan 2001

  • RE: PatExclude8K

    Thank you for checking it out.

    Kristen-173977 (9/16/2015)


    Very useful function, thank you.

    Hopefully not a stupid question?!! but is there is reason why this is a table-valued function rather than...

    "I cant stress enough the importance of switching from a sequential files mindset to set-based thinking. After you make the switch, you can spend your time tuning and optimizing your queries instead of maintaining lengthy, poor-performing code."

    -- Itzik Ben-Gan 2001

  • RE: Suggestion:SQL Server Wiki

    Cool idea... I'd happily contribute.

    "I cant stress enough the importance of switching from a sequential files mindset to set-based thinking. After you make the switch, you can spend your time tuning and optimizing your queries instead of maintaining lengthy, poor-performing code."

    -- Itzik Ben-Gan 2001

  • RE: Dynamic String Replacement

    I'm a little late to the party but let's not forget about PatExclude8K[/url].

    Here's two Patexclude8K solutions:

    SELECT Data = NewString

    FROM #Tab

    CROSS APPLY dbo.PatExclude8K(data,'[= 0-9]');

    SELECT Data = NewString

    FROM...

    "I cant stress enough the importance of switching from a sequential files mindset to set-based thinking. After you make the switch, you can spend your time tuning and optimizing your queries instead of maintaining lengthy, poor-performing code."

    -- Itzik Ben-Gan 2001

  • RE: Need help to build recursive query

    mister.magoo (9/15/2015)


    You can also improve on that a bit Alan, it won't scale at all well (try it for a sample of 700 rows)

    I would always try and keep a...

    "I cant stress enough the importance of switching from a sequential files mindset to set-based thinking. After you make the switch, you can spend your time tuning and optimizing your queries instead of maintaining lengthy, poor-performing code."

    -- Itzik Ben-Gan 2001

  • RE: Need help to build recursive query

    You can simplify your query like this:

    IF OBJECT_ID('tempdb..#Table') IS NOT NULL DROP TABLE #Table;

    CREATE TABLE #Table ( MAIN INT,SUB1 INT,SUB2 INT,[STATUS] VARCHAR(10),MODIFIED VARCHAR(10))

    INSERT INTO #Table(MAIN,SUB1,SUB2,[STATUS])

    VALUES (1,2,4,'Valid'),(2,4,5,'Valid'),(3,6,4,'Valid'),(4,2,1,'Valid'),(5,3,4,'Valid'),(6,0,0,'Invalid');

    DECLARE @count INT =...

    "I cant stress enough the importance of switching from a sequential files mindset to set-based thinking. After you make the switch, you can spend your time tuning and optimizing your queries instead of maintaining lengthy, poor-performing code."

    -- Itzik Ben-Gan 2001

  • RE: Are the posted questions getting worse?

    I've seen this since 6.5 or 7.0 and it's still my favorite error.

    "I cant stress enough the importance of switching from a sequential files mindset to set-based thinking. After you make the switch, you can spend your time tuning and optimizing your queries instead of maintaining lengthy, poor-performing code."

    -- Itzik Ben-Gan 2001

  • RE: FK - SQL help please

    What have you tried so far?

    "I cant stress enough the importance of switching from a sequential files mindset to set-based thinking. After you make the switch, you can spend your time tuning and optimizing your queries instead of maintaining lengthy, poor-performing code."

    -- Itzik Ben-Gan 2001

  • RE: DBA career advice

    I was a DBA from for a few years and have since moved on to Business Intelligence.

    There seems to be some debate about this but, from what I've seen,...

    "I cant stress enough the importance of switching from a sequential files mindset to set-based thinking. After you make the switch, you can spend your time tuning and optimizing your queries instead of maintaining lengthy, poor-performing code."

    -- Itzik Ben-Gan 2001

  • RE: Query Processing Question

    FYI regarding my post. I am using SSMS 2012 but got the error on a 2014 server (probably would have been more appropriate to post this under 2014).

    brad.mason5 (9/11/2015)


    I...

    "I cant stress enough the importance of switching from a sequential files mindset to set-based thinking. After you make the switch, you can spend your time tuning and optimizing your queries instead of maintaining lengthy, poor-performing code."

    -- Itzik Ben-Gan 2001

Viewing 15 posts - 1,261 through 1,275 (of 2,462 total)