Forum Replies Created

Viewing 15 posts - 2,251 through 2,265 (of 2,462 total)

  • RE: Help with a query to get substring

    I created some test data to show a different way using the patternSplit function from here[/url].

    --Setup sample data

    IF OBJECT_ID('tempdb..#temptesttable') IS NOT NULL

    DROP TABLE #temptesttable;

    CREATE TABLE #temptesttable (EventText varchar(100));

    INSERT #temptesttable

    VALUES('Receiving...

    "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: index scan

    See the notes in my code. My understanding, too, is that you will always get a scan (index or table) unless you provide a filter. E.g. Select * FROM x...

    "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: read values in column from xlsx files in SSIS

    kpann (4/18/2013)


    I'm working on a SSIS project that will automate every process. I still want to give it a try...

    When you download the zip files, you'll notice that I have...

    "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: Update on ID's

    RexHelios (4/18/2013)


    venkyzrocks,

    I agree with Sean Lange. More clarity and some ground to get others started would be nice to have.

    Having said that, I have created table variables to simulate...

    "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: Update on ID's

    I am with Sean and venkyzrocks about providing more detail. That said, I think you are looking for this:

    --SETUP SAMPLE DATA

    ------------------------------------------------------------------------------

    IF OBJECT_ID('tempdb..#old_fact') IS NOT NULL

    DROP TABLE #old_fact;

    IF OBJECT_ID('tempdb..#Dim_FiscalYear_Old') 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: read values in column from xlsx files in SSIS

    kpann (4/18/2013)


    i know this sounds silly but will it be helpful if i upload my zip folder so you can understand it better?

    By zip folder are you talking about 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: A Simple Formula to Calculate the ISO Week Number

    Wow.

    Amazing work Jeff. Great article too. 5 stars.

    "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: Column name or number of supplied values does not match table definition

    ... once you fix that you can do something like this (with or without the UNION statement commented.

    IF EXISTS (SELECT * FROM INFORMATION_SCHEMA.ROUTINES WHERE ROUTINE_NAME='deleteme2')

    DROP PROC deleteme2;

    GO

    CREATE PROCEDURE deleteme2...

    "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: Column name or number of supplied values does not match table definition

    First, take a look at your temp table and the code in testProc2

    CREATE TABLE #Test

    (

    a float,

    b float,

    c float,

    d float,

    e float,

    f int,

    g float,

    h DECIMAL(22,2),

    i DECIMAL(22,2),

    j DECIMAL(22,0),

    k DECIMAL(22,2),

    l float,

    m float

    )

    GO

    INSERT INTO #Test

    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: Broadcast calender generator

    Thank you Jeff.

    sql_r:... Sorry about that :blush: - I should have googled "Broadcast Calendar" or "Broadcast week" before giving this a shot. It's been a busy couple weeks (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: Broadcast calender generator

    Lynn,

    Good eye. Thanks. 😉

    Lowell,

    Both your quotes are great. I actually wonder how many people who come to SSC google "There is no spoon". I know I did. It took me...

    "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: Broadcast calender generator

    The query below should do the trick. I don't know what day counts as "Media Start of Week" but I went with monday (isowk). Also, I don't know what 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: Performance Problem

    For better, quicker answers on T-SQL questions, click on the following...

    http://www.sqlservercentral.com/articles/Best+Practices/61537/

    For better answers on performance questions, click on the following...

    http://www.sqlservercentral.com/articles/SQLServerCentral/66909/

    "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: Substring with IF or CASE statement

    First, welcome to SSC. To save you some grief - in the future I would suggest posting some DDL so that we can better understand exactly what you are trying...

    "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 is SQL query processed in this example?

    cnayan (3/19/2013)


    Thanks Alan.B for testing it extensively! 🙂

    When I ran your queries, like:

    select n.*

    from Names n

    FULL JOIN TableB b ON n._id=b._id

    WHERE LEFT(name,1)='A'

    AND ChildCount>50

    it showed Nested Loop as you suggested.

    But, I...

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