Forum Replies Created

Viewing 15 posts - 991 through 1,005 (of 2,458 total)

  • RE: SELECT .. INTO to replace empty string or NULL value

    No problem. 😎

    "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 Parameters in a Query is Killing Performance

    The UpdateDt column in the Users table is DATETIME so I wouldn't expect any datatype conversion issues.

    Perhaps... To know for sure check the query plan (the actual query plan, not...

    "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 Parameters in a Query is Killing Performance

    Sergiy (2/17/2016)


    Make the PK on UserID non-clustered and create a clustered index on UpdateDt.

    Unless UpdateDt is not unique. Then perhaps a clustered index on composite key consisting of UpdateDt 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: Query Substring and Uppercase

    Use the UPPER function.

    "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: CUBE question

    The SQL Server Analysis Services (SSAS) Tutorial[/url] on mssqltips aint bad as it uses adventureworks as an example which is available online for free. If you are serious, I strongly...

    "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: SELECT .. INTO to replace empty string or NULL value

    Did what I posted help?

    "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: SELECT .. INTO to replace empty string or NULL value

    Implicit conversion is treating your '' value as a zero and making the column a numeric column. When you query a numeric column:

    WHERE Column3 = ''

    is the same...

    "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: Similar trainings to SQL Saturday?

    Eric M Russell (2/17/2016)


    Local user group meetings offer a similar experience. Also, you can find tons of recorded presentations on sites like YouTube and SQLBits.

    +1

    There's so much good free...

    "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: Display numeric as empty string based on condition

    Luis Cazares (2/17/2016)


    You might want to reduce your varchar length. I've never heard of a common use for such large numbers.

    haha - I missed the comment about converting to varchar(100)....

    "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: Similar trainings to SQL Saturday?

    When Redgate SQL in the City comes around that's similar to SQL Saturday. I know this was not your question but it's worth mentioning.

    I don't know about the other...

    "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: Display numeric as empty string based on condition

    Here's two options:

    DECLARE @table TABLE (CashFlowCoverage int);

    INSERT @table VALUES (1),(2),(-999),(999);

    SELECT CashFlowCoverage = NULLIF(NULLIF(CashFlowCoverage,-999),999)

    FROM @table;

    SELECT CashFlowCoverage = NULLIF(ABS(CashFlowCoverage),999)

    FROM @table;

    EDIT: changed the column 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: Iterate though Sub OU of main OU

    It's been awhile since I wrote an LDAP query...

    If you can post some sample data for what of #tempAD I'm sure I can help 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: Display numeric as empty string based on condition

    Luis beat me to it. Note the code/comments below.

    DECLARE @table TABLE (NumericColumn int);

    INSERT @table VALUES (1),(2),(-999);

    -- This WONT work because blanks on numeric columns are returned as 0's

    SELECT NumericColumn...

    "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 for VARCHAR field

    SQL!$@w$0ME (2/17/2016)


    Thanks.

    For VARCHAR [varchar(MAX) & varchar(800] fields on two different tables. This fields are intended to use in WHERE CLAUSE (using 'like').

    You can't add a nonclustered index with a varchar...

    "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 Query to Extract after 2nd - in a field

    trvlbabie (2/16/2016)


    When I add the line: SUBSTRING(String, 10, 5)

    It is giving me the following error: SQL API: [SQLExecDirectW], SQL RETURN: [-1], SQL STATE: [42000], SQL NATIVE ERROR:...

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