Forum Replies Created

Viewing 15 posts - 826 through 840 (of 2,462 total)

  • RE: Max value in Case Statements

    Some people beat me to it but this was my test:

    SET NOCOUNT ON;

    CREATE TABLE #temp (ID int identity primary key, [Date] DATE NOT NULL);

    CREATE INDEX dt ON #temp([date]);

    INSERT INTO...

    "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: Max value in Case Statements

    Luis Cazares (4/20/2016)


    A different version.

    WITH Table1(ID,Date) AS

    (SELECT ID,Date FROM (

    VALUES

    (1 ,'1/1/1900')

    ,(2 ,'1/1/1900')

    ,(3 ,getdate() )

    ,(4 ,Getdate() )

    ) AS X(ID,Date))

    SELECT

    T1.ID

    ,T1.Date

    ,CASE

    WHEN...

    "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: CONCAT

    Nice one.

    "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: maintance plan vs Sql job

    Simpy put - when you create a maintenance plan and schedule it you are creating a new SQL Agent Job that runs your "maintenance plan" at a time of your...

    "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: Building BI from Scratch!

    singhamitpal (4/19/2016)


    Thanks for the response...

    I’VE have been advised to stay away from the stored procedures meaning the business logic should NOT be stored in stored procedures, except where really really...

    "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: Windowing functions vs Non-deterministic ROW-NUMBER()

    This is a very interesting subject, one of spent a lot of time looking into and something worth really understanding when dealing with "Ranking" functions. First (in case you run...

    "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: Performance tuning a query

    Also...

    order by T.samplePartnerCode

    What's the purpose of this other than to make your query slower? If you truly need a presentation ORDER BY let the application do it.

    "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: creating a MDX query using a control?

    doug moore (4/18/2016)


    I currently have a very old dundas control that creates a MDX query using their object

    DundasOlapDataProvider > Dundas.Olap.Data.DimensionDescriptor

    we moved away from this dundas and moved towards Telerik....

    "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: Friday Shirts

    Well, I got this one wrong. I know that at least one of the Friday shirts has boats on it though...

    "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: Exporting Azure Data Factory (ADF) into TFS Source Control

    Good stuff Jeff!

    "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: Deleting All Characters before 2 Set Characters

    les.61 (4/17/2016)


    SSCommitted, Many thanks I have tried the "s2 = SUBSTRING(someString,CHARINDEX('PP', someString)+2,8000)" option and it works well for the entries in question However for some entries that have no PP...

    "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: Function for String Occurences Count

    You can use NGrams8K for a set-based way of solving this kind of thing.

    The function:

    CREATE FUNCTION dbo.NGrams8k

    (

    @string varchar(8000), -- Input string

    @N ...

    "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: Deleting All Characters before 2 Set Characters

    This will do the trick (note my comments).

    DECLARE @yourTable TABLE (someString varchar(100));

    INSERT @yourTable

    VALUES ('DDR Return PP12345'),('DDR Resturns PP12356'),('DDR Retunrs PP12367');

    SELECT someString,

    ...

    "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: Some performance improvements tips required at server level

    [Quote]1. Moving mdf,ldf,tempdb to seperate drives.[/quote]

    Yes, you want to do that anyhow but yes, do that.

    2. Create 2 server one for transactions and one for reporting ,replicating data to second...

    "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: Search a string in a text with number of occurrences

    I know thread is a little old but this is exactly the kind of thing you could do with a good NGrams8K function. Here's the function:

    CREATE FUNCTION dbo.NGrams8k

    (

    @string...

    "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 - 826 through 840 (of 2,462 total)