Forum Replies Created

Viewing 15 posts - 2,101 through 2,115 (of 2,462 total)

  • RE: import string with array into table

    You can also use PatternSplitCM (note the link in my signature)....

    declare @val varchar(8000)= '[{mark,peters,mr}{jane,fonda,mrs}{john,doo,mr}{james,bond,mr}]';

    WITH x AS

    (

    SELECT ItemNumber, Item

    FROM dbo.PatternSplitCM(REPLACE(REPLACE(@val,'[{',''),'}]',''),'%[}{]%')

    WHERE Matched=0

    )

    SELECTROW_NUMBER() OVER (ORDER BY x.ItemNumber) AS Id,

    MAX(CASE WHEN ps.ItemNumber=1 THEN...

    "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 you map to rows inside different branches of same XML document using OPENXML rowset function?

    LutzM (10/7/2013)


    Here's a slightly different approach without the OPENXML approach (I, personally, find OPENXML more complicted and it seems to be less efficient in most cases):

    SELECT

    TempXML1.Node1.value('(server/text())[1]', 'varchar(50)') AS [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: How do you map to rows inside different branches of same XML document using OPENXML rowset function?

    This is what you are looking for

    EXEC sp_xml_preparedocument @dochandle OUTPUT, @xmldocument;

    SELECT

    server,

    name,

    start_time,

    type,

    log_name,

    media_mount_date,

    drive_name,

    media_label,

    media_guid,

    media_overwrite_date,

    media_append_date,

    media_set_target

    FROM OPENXML(@dochandle, 'joblog', 1)

    WITH

    (

    server [varchar](20) 'header/server/text()',

    name [varchar](300) 'header/name/text()',

    start_time [varchar](100) 'header/start_time/text()',

    type varchar(20) 'header/type/text()',

    log_name...

    "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: Paramater Concatenation

    You can include table names or derived tables in your from clause but not a non-static value. Dynamic SQL (using sp_executesql not EXEC) is the way to go for this.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: Pass data from SSRS report result set to Webform

    No problem, good luck!

    "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: Pass data from SSRS report result set to Webform

    What I want to know:

    Is it possible to have the SSRS report contain links within the results of the report that can be passed back to a Webform so that...

    "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: Printed Books Vs E-Books

    Printed books -- 100%.

    I read pdf's & ebooks on my phone & tablet but this is only when it would not be convenient to huff around a real book.

    "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: Support of JET OLEDB

    I have always done this manually because of the types of SSIS packages I have dealt with did not work well with the Visual Studio conversion wizard. That said, here's...

    "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 When dropping multiple tables

    Steve Smith-163358 (10/2/2013)


    Hi,

    The software we use often creates a lot of temporary tables that need to be deleted from time to time.

    Depending on the usage, this can range from hundreds...

    "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: t-sql is bigger

    I would strongly encourage you to look at the article that Gail posted.

    I currently have a database of 80[gb]. did a shrink log file to 1 mega byte.

    For a database...

    "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 Level/Aliasing Help

    erikd (9/30/2013)


    Actually, this seems to get me where I need to go. For some reason the tutorial I watched had @ signs in alias paths(?). When I took them out,...

    "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 Level/Aliasing Help

    This is what you are looking for.

    DECLARE @x xml;

    SELECT @x = P

    FROM OPENROWSET (BULK '\\usd\SurveyComputing\Sample\SampleRepository\Visit_Survey_2013_08_16_07_21_43.XML', SINGLE_BLOB) AS FMG(P)

    DECLARE @hdoc int

    EXEC sp_xml_preparedocument @hdoc OUTPUT, @x

    select *

    from OPENXML (@hdoc, 'SURVEY_EXTRACT/VISIT_SURVEY',...

    "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 run multiple stored procedures in parallel?

    For what you are doing I think Sean's solution is the way to go. That said, you could run them in parallel in an SSIS package then have your proc...

    "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: Trouble with nested CTE

    Taking what Keith said, you could re-write your query like this:

    WITH cteSource(CN, U1)

    AS (

    SELECTr.CN, r.U1

    FROM dbo.SSS AS s

    INNER JOINdbo.STU AS t ON t.SN = s.SN

    INNER JOINdbo.CRS AS...

    "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: Using Dynamic SQL to build temp table...doesn't work?

    What Louis posted is the way to go; no DSQL needed for what you are doing. That said, to accomplish this with a temp table you would need to use...

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