Forum Replies Created

Viewing 15 posts - 4,681 through 4,695 (of 8,731 total)

  • RE: Need help with the sql code

    If you're using natural quarters, you might be able to use something like this:

    WITH TableA([date],[ID])

    AS

    (

    SELECT '2012-09-21','1' UNION ALL

    SELECT '2012-09-28','1' UNION ALL

    ...

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • RE: Issue finding best way to manipulate date in where statement

    The problem is that you're comparing the same column and same row expecting it to have different values.

    What you need is a self join. Something like this:

    select GLAccum.Endbal, GLAccum.Base, GLAccum.Division,...

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • RE: Stored Procedure error when changing compatibility mode to 90 (2005)

    You're welcome.

    Next time, avoid posting lengthy procedures and post only the ones relative to the errors. If you double click on the error, it will locate it for you. You...

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • RE: Issue finding best way to manipulate date in where statement

    Considering the ACCTPERIOD has a value of 16456874

    Which would be the correct result?

    164412 (first four digits minus one with a two digit suffix of 12)

    16440012 (first four digits...

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • RE: Return all rows with matching columns, different filter ...

    And what's the problem of the current query other than not being SARGable?

    Try to avoid functions on columns in the WHERE clause. The condition can be changed like this:

    SELECT *...

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • RE: Return all rows with matching columns, different filter ...

    Based on your sample data, what are your expected results?

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • RE: Inserting Dummy Records using loop statement

    These articles might help you:

    Generating Test Data: Part 1 - Generating Random Integers and Floats[/url]

    Generating Test Data: Part 2 - Generating Sequential and Random Dates[/url]

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • RE: Numeric/Negative Check

    The reason for getting errors on queries like

    select * from table WHERE ISNUMERIC(LTRIM(RTRIM(Capacity))) = 1 AND Capacity < 0

    Is that SQL is a declarative language, so even if you write...

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • RE: Stored Procedure error when changing compatibility mode to 90 (2005)

    Basically, you need to change the columns in the group by in this update

    update [tempdb..##Performance_SUM_Detail_Data_table] set Produced = (select sum(Producd)

    from X_Produced_By_Period where

    B2BNR = bu AND B2PLT = PLT AND B2BBE...

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • RE: Any Third Party DR solutions for SQLServer 2014 Standard Edition

    You say Disaster Recovery but you only mention High Availability solutions.

    What do you really need?

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • RE: Where clause - Decrypt column or hash?

    dba-wannabe (7/16/2015)


    Should I/we add a column to hold a hash of the SSN; and use the hash for comparisons?

    This.

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • RE: Can anyone help get this to run?

    If you can see the leading zeros in the file using notepad or something similar, that might be an excel problem. Be sure to define that column as string when...

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • RE: Can anyone help get this to run?

    This is either a permissions problem because the service account doesn't have permissions to access the path or the path might not exist. Remember that local paths refer to the...

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • RE: Nested query retrieving min and max values

    That's because you're returning 2 values to assign a single scalar value.

    Here's a refactored version of your query to avoid an additional hit on the table.

    select DISTINCT

    ...

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • RE: Can anyone help get this to run?

    That's because the code stopped and never dropped the temp table.

    Drop it before running the code again. Even better would be to have something like this before creating the table:

    IF...

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2

Viewing 15 posts - 4,681 through 4,695 (of 8,731 total)