Forum Replies Created

Viewing 15 posts - 871 through 885 (of 2,462 total)

  • RE: About Index - Can we create a nonclustered index on clustered index column

    It will increase performance if the index is used by the optimizer for SELECT statements. Say the column name is C1 and you execute: SELECT C1 FROM youratable......

    "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: Adding totals for previous two days

    Using GetNumsAB[/url], this may be better:

    WITH base AS

    (

    SELECT rn, d = DATEADD(DAY,n2,mn), mn = DATEADD(DAY,rn,mn), mx = DATEADD(DAY,n1,mn)

    FROM

    (

    SELECT...

    "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: Adding totals for previous two days

    If you had 2012 this would be much easier. I have to think about this a little; the most straight-forward solution is a "triangular join" that looks like this:

    WITH...

    "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: Migrate Databases Report Server and Report Server tempDB

    WhiteLotus (4/4/2016)


    Hi All,

    I am about to migrate some databases consist of user databases and also Report server and Report server TempDB from 1 server to another server

    Question :

    The destination server...

    "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: Would You Move For a Job?

    I can't stand living in Chicago anymore so, yes! If I have to live in the Midwest, Chicago is the place to be but I don't want to live in...

    "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: Sharing data outside company best practices

    phingers (4/4/2016)


    Hi,

    I have an SSIS package which emails data in XML file format to an external company on a regular basis.

    They have requested that we allow them access to our...

    "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: DelimitedSplit8K versus DelimitedSplit_Long

    ben.brugman (4/4/2016)


    Referenced sites and threads:

    Any other advises here about extending the 8K version ?

    ...Remark, I started this new thread because I think this subject of enlarging the capacity of the...

    "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: Convert a string with an array of variables?

    DesNorton (3/31/2016)


    Alan.B (3/30/2016)


    This is the kind of thing that you can do with a Translate function (which T-SQL does not have). I generally don't like scalar UDFs but this guy...

    "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: Convert a string with an array of variables?

    Ed Wagner (3/31/2016)


    Alan.B (3/30/2016)


    This is the kind of thing that you can do with a Translate function (which T-SQL does not have). I generally don't like scalar UDFs but this...

    "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: Calendar Table Function

    ScottPletcher (3/31/2016)


    Alan.B (3/30/2016)


    Alan.B (3/30/2016)


    ScottPletcher (3/30/2016)


    Alan.B (3/30/2016)


    ScottPletcher (3/30/2016)


    Alan.B (3/29/2016)

    Lastly, ditto the last Thursday of the month:

    SET STATISTICS IO ON;

    PRINT 'Old way:';

    SELECT DISTINCT MAX([Date]) OVER (PARTITION BY [Year],[MonthName],[WeekdayName]) AS [Date]

    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: Convert a string with an array of variables?

    mceventphoto (3/31/2016)


    Drew,

    I like your solution better. It is short and clean.

    Thanks,

    MC

    Did you look at the Translate8K solution?

    DECLARE @RandomString varchar(100) = '0123456789000';

    SELECT dbo.Translate8K(@RandomString,'1234567890','ABCDEFGHI$');

    -- Returns: $ABCDEFGHI$$$

    "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: String manipulation options

    If you are just pulling out the email addresses this is certainly something that can be resolved with a simple splitter, CHARINDEX, PATINDEX and a couple other simple tricks. I'll...

    "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: Convert a string with an array of variables?

    Sergiy (3/30/2016)


    Solution is suprisingly simple.

    1. Create a "translation" table:

    CREATE TABLE #Mapping (

    FromChar NCHAR(1) PRIMARY KEY,

    ToChar NCHAR(1)

    )

    INSERT INTO #Mapping ( FromChar, ToChar )

    SELECT 1, 'A'

    UNION ALL

    SELECT 2, 'B'

    UNION ALL

    SELECT...

    "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: Is PowerShell Intimidating?

    Powershell is cool. I only worked with it once for about 10 weeks scripting out a SQL Server Install in the Google cloud using the Google SDK. As some people...

    "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: Convert a string with an array of variables?

    This is the kind of thing that you can do with a Translate function (which T-SQL does not have). I generally don't like scalar UDFs but this guy is faster...

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