Forum Replies Created

Viewing 15 posts - 1,936 through 1,950 (of 2,458 total)

  • RE: returning only portion of string

    Without using parsename:

    ;WITH sample_data(val)

    AS

    (

    SELECT '1.9999-Q1'

    UNION SELECT '01.9999-Q11'

    )

    SELECTval,

    part1 = substring(val,1,charindex('.',val)-1),

    part2 = substring(val,charindex('.',val)+1,(charindex('-',val)-charindex('.',val))-1),

    part3 = substring(val,charindex('-',val)+1,...

    "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 to join to a comma delimited list

    rightontarget (6/16/2014)


    Hi all,

    I have a table:

    id pallet color

    1 a red,blue

    2 ...

    "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: Identifying cause of poor perfomance

    This click takes less than a second in staging and about 33 seconds in production.

    A common cause of this kind of problem is when critical indexes are not moved...

    "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: Database Size is shwoing Much larger then Actual Data

    This Database used to be in simple recovery model and I did change it to Full now. I am taking T-log backup and full backup .

    No, no... My apologies...

    "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 like some feedback on contractors as employers

    Doctor Who 2 (6/12/2014)


    Alan.B (6/11/2014)


    I am going to make a wild guess and say that you are in Albuquerque, NM or somewhere nearby? I don't know much about that market...

    "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: Database Size is shwoing Much larger then Actual Data

    Users say a lot of things...

    A few questions to help you sort this out:

    1) Do you track your DB growth? Do you have any idea how fast this DB...

    "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: SQL 2008 R2 Standard vs Enterprise on Parallelism

    ...what's missing from Standard SQL edition where parallelism is concerned. I thought it was only for special index operations... are we talking about two different things?

    I just wanted to add...

    "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 like some feedback on contractors as employers

    I am going to make a wild guess and say that you are in Albuquerque, NM or somewhere nearby? I don't know much about that market but know that there...

    "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 XPath to FLWOR

    Can anyone help me build a FLOWR-based query that produces the same result as the pure XPath one?

    I don't know if that is possible. I thought I saw an article...

    "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: Regroupement sur interval de date

    Premièrement, je ne parle pas français. Je n'ai pas une solution complète mais cela devrait aider...

    passer à l'anglais(switching to English)...

    OK. You have the following data:

    -- données de l'échantillon

    IF...

    "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: When criteria in the where clause result is different than the same criteria in the on clause. Why?

    I think we could figure this out a little easier if you included the query plan the each query produces. Could you run this with " include actual query plan"...

    "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: XML To SQL conversion

    clucasi (5/28/2014)


    ...the problem I am having is that the XML has two row nodes.

    The deal with two nodes with the same name you could refer to them by their position....

    "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: XML To SQL conversion

    Eirikur Eiriksson (5/28/2014)


    Here is a very simple approach

    😎

    USE tempdb;

    GO

    DECLARE @TXML XML = N'<?xml version="1.0"?>

    <CommonEventData>

    <Row>

    <CallSource>999</CallSource>

    <CallerCityStateZipCode>

    </CallerCityStateZipCode>

    <CallerName>TEST</CallerName>

    <CallerPhone>TEST</CallerPhone>

    </Row>

    <Row>

    <Beat>E27</Beat>

    <MultiEventId>0</MultiEventId>

    <PrimaryUnitId>E09A1</PrimaryUnitId>

    </Row>

    </CommonEventData>'

    SELECT

    MAX(RO.W.value('CallSource[1]','NVARCHAR(50)') ...

    "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: seven digit random number

    You could go with:

    SELECT cast(8999999*rand() as int)+1000000

    For multiple rows you could go with:

    SELECT cast(8999999*rand(cast(newid() AS varbinary)) as int)+1000000

    FROM <something>

    Edit: typo

    "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: Stairway to SQL Server Security: Level 1, Overview of SQL Server Security

    I just read this. Great work Don. Very thorough and a really good read. I am looking forward to the rest of the SQL Server Security stairways!

    "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,936 through 1,950 (of 2,458 total)