Forum Replies Created

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

  • 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

  • RE: How is SQL query processed in this example?

    cnayan (3/19/2013)


    My question is the latter one - which is more efficient.

    I tested this a little and here's what I determined: Both queries you posted will produce the exact...

    "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: Backup databases depending on the size to multiple files

    pehlebhiayatha (3/19/2013)


    Alan,

    Sorry for the late response. I tested the script and it works great. But I want to split the backup files to multiple files if the database size 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: Help with the query!

    I worked on this for awhile and this was the best I could come up with...

    -- SAMPLE DATA

    IF OBJECT_ID('tempdb..#Weekday') IS NOT NULL DROP TABLE #Weekday; CREATE TABLE #Weekday(Weekday_id int...

    "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: Ways to replicate

    zouzou (3/12/2013)


    Hello,

    I have a live db that users need to access it for reporting purposes. What is the best way to let them access [it] without [affecting live]?

    They...

    "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,458 total)