Forum Replies Created

Viewing 15 posts - 511 through 525 (of 2,462 total)

  • RE: Searching set of words by ignoring spaces

    Luis Cazares (8/25/2016)


    The Dixie Flatline (8/25/2016)


    But isn't the problem with just replacing spaces is that it doesn't deal with other special characters?

    It depends on what you're doing.

    My strategy (which varies...

    "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: Searching set of words by ignoring spaces

    ScottPletcher (8/25/2016)


    Rather than literal strings of spaces, I recommend using SPACE(), just for readability:

    /*CREATE FUNCTION ...*/

    SELECT REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(LTRIM(RTRIM(@Text)),

    SPACE(33), ' '),

    SPACE(17), ' '),

    ...

    "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: difference betwwn inner join and intersect in sql

    Joins are one of the four table operators in MS SQL Server (the others are APPLY, PIVOT and UNPIVOT). Joins are used for joining tables (real or derived).

    INTERSECT, EXCEPT, UNION...

    "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: Today's Random Word!

    BWFC (8/25/2016)


    Prefect

    day

    "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: Check constraint based on other tables

    Welcome to the SQLServerCentral forums.

    This should be easy to sort out but it would help if you could provide some DDL, a few rows of sample data and an...

    "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: Converting a XML datatype to varchar(max).

    ben.brugman (8/23/2016)

    I would like a solution without the FOR XML, is there one ?

    I think there is. I generally avoid scalar user defined functions like the plague but check 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: Converting a XML datatype to varchar(max).

    Matt Miller (#4) (8/24/2016)


    mister.magoo (8/24/2016)


    Sergiy (8/24/2016)


    mister.magoo (8/23/2016)


    To answer your question about how (not getting involved in why)

    declare @x xml;

    select @x=(

    select ''+b

    from

    (

    select 'hello;friend'+CHAR(13)+CHAR(10)

    union all

    select 'my;world'+CHAR(13)+CHAR(10)

    )a(b)

    for xml path(''),type);

    select @x.value('(./text())[1]','nvarchar(max)')

    the important things...

    "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: Converting a XML datatype to varchar(max).

    ben.brugman (8/23/2016)


    XML

    is not the purpose and not a target it is only the means to get to something.

    So why FOR XML? The reason for this is that FOR XML concatenates...

    "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: How do we send a SSRS report by email based on a condition

    Have a look at Data Driven Subscriptions.

    "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 Performance help needed

    It looks like you can re-write your code to eliminate the cursor - that cursor is going to slow you down. I would also run this stored procedure using 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: Converting a XML datatype to varchar(max).

    With FOR XML a large string is build from tablecontent.

    The result is stored as a XML datatype in a table.

    What is the purpose of this?

    If the primary purpose is...

    "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: Job to Back Up DB structures only

    As Phil eluded to, this is best handled via source control. Another way to get collect definitions is to use dbo.sp_GetDDL[/url]

    This is a script I use to pull all 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: Temp Table 'vs' Table Variable 'vs' CTE.

    growlingly poor English

    :hehe::hehe::hehe: +1

    I never heard the word growlingly before so I looked up the Webster definition.

    Growl´ing`ly

    adv.1.In a growling manner.

    "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: Optimize update with an index

    The only way to know what's happening now and how adding an index will change things is to look at the execution plan before and after and test it.

    Based on...

    "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: What is the impact of setting SET ANSI_WARNINGS OFF?

    Great article. Well done. Scary.

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