Forum Replies Created

Viewing 15 posts - 466 through 480 (of 2,458 total)

  • RE: Multiple fields in the group

    In Visual Studio:

    1. Create an SSRS table with columns for surgical procedure & surgery date.

    2. Click on that table then, under Row Groups, right-click on the "=(details)" group and...

    "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 there a way to select column data for columns with an ordinal position < a particular ordinal position?

    Why not just create a table that contains the column names of <mytable> and their ordinal position. You could name it <mytable>_cols. Then use some logic in your dynamic SQL...

    "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: Run out dates

    I think that this is what you are looking for:

    -- Sample data

    IF OBJECT_ID('tempdb..#YourData') IS NOT NULL DROP TABLE #YourData;

    SELECT *

    INTO #YourData

    FROM

    (VALUES

    ('162386-00','CHB',263,203,143,83,23,0,0),('162386-00','GRR',44,44,44,44,44,44,44),

    ('162386-00','MAR',0,0,0,0,0,0,0),('162387-00','CHB',83,83,83,83,83,83,83),

    ...

    "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 takes 1.5 minutes from SQL but more than 1 hour from application

    EasyBoy (9/13/2016)


    We have one query which used by users to pull the report everyday in the morning. Which, i generally run through SQL and it takes only 1 to 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: Running totals on different columns

    TheSQLGuru (9/12/2016)


    ROWS is (almost ?) ALWAYS offers MUCH better performance than RANGE! Try your best to use ROWS when possible.

    I don't know about ALWAYS. I said ROWS "often" (and could...

    "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: Running totals on different columns

    You beat me to it. Note that ROWS often performs better than range and can be used to calculate your HQuantity. Also note that the subquery is not required, you...

    "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 I assign the correct date ?

    chris.evans 94907 (9/12/2016)


    Hi Alan,

    Thanks for the reply.

    The script you provided returns the following results:

    calDate ...

    "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: Teaching a dog to sing

    My advice to managers is always to keep up with technology and maintain their technical skills.

    Since getting into technology in 1999 I've worked for two types of bosses:

    1. Those...

    "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: Are the posted questions getting worse?

    The Dixie Flatline (9/9/2016)


    Alan.B (9/9/2016)


    I just spent 5 minutes trying to figure out whey this INSERT statement was failing

    "Whey" is the second hint. Have a great weekend 😀

    You...

    "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 I assign the correct date ?

    Ed Wagner (9/9/2016)


    Alan.B (9/9/2016)


    Haha, silly American! I think "06/09/2016 " is September 6th where the OP is from. 😛

    Touche, sir. I never thought to check the profile to see...

    "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: Are the posted questions getting worse?

    I just spent 5 minutes trying to figure out whey this INSERT statement was failing:

    CREATE TABLE dbo.MyTable

    (

    SocialAdvertisingDimAdKey int IDENTITY(1,1) NOT NULL,

    ...

    "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 Import XML data into one single table in SQL server using SSIS

    hegdesuchi (9/9/2016)


    Hi,

    OPENXML works fine if all have single parent node.

    But I might want columns for different nodes. Do we have any option?

    Thanks

    Post a sample of the XML you're working...

    "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 I assign the correct date ?

    Ed Wagner (9/9/2016)


    chris.evans 94907 (9/9/2016)


    Hi Alan/Mike,

    Following on from this, I'm looking to add a DATEDIFF calculation between today's date 'GETDATE()' and each individual date but only where the Working 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: how to Import XML data into one single table in SQL server using SSIS

    OPENXML should work just fine for this task.

    "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 to find missing data

    Here's some sample data and an example of how to use LAG to get you started.

    DECLARE @sometable table (ID int, DeviceID int, Value decimal(8,1), DT datetime);

    INSERT @sometable

    VALUES

    (22, 4, 23.6,...

    "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 - 466 through 480 (of 2,458 total)