Forum Replies Created

Viewing 15 posts - 1,501 through 1,515 (of 8,731 total)

  • RE: Selecting a Column dynamically

    I'd prefer if you stay out of dynamic SQL for this. Here's another option.
    SELECT CASE MONTH(GETDATE())
       WHEN 1 THEN JanTarget
       WHEN 2 THEN...

    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: Retrieve value from a string

    Best option, stop getting values like that.
    Alternative option, try the following code:

    SELECT ID, CustomFields,
      ISNULL(SUBSTRING( s.Item, 7, NULLIF(CHARINDEX('"', s.Item, 7), 0)-7), '') AS CustomId,

    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: Today's Random Word!

    Revenant - Monday, March 6, 2017 8:47 AM

    Ed Wagner - Monday, March 6, 2017 5:58 AM

    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: Help with % calculation please

    faulknerwilliam2 - Monday, March 6, 2017 7:29 AM

    Hello

    I am trying to get an output that will show me:

    Total number of deliveries missed...

    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 in SQL for Wonderware Historian not Working*********URGENT

    TheSQLGuru - Monday, March 6, 2017 6:56 AM

    Whenever doing dynamic SQL, PRINT is your friend!! I NEVER execute something I am creating...

    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: How to make one innerjoin to bring all value of all the substrings within a string separated by a comma

    benkraiemchedlia - Friday, March 3, 2017 12:39 PM

    Hi, 
    I have two tables, answers and lookup, In my answer table I have a field...

    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: CTE not working properly

    skb 44459 - Friday, March 3, 2017 12:29 PM

    This does not build the hierarchy.

    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: CTE not working properly

    What's the problem with that code?

    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: Use date and time in sql statement for join, but not required in the output

    walter.dziuba - Friday, March 3, 2017 12:15 PM

    I`m attempting to remove the ``*`` from the statement and trying to only select on...

    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: SQL question ? How can we find all the occurrences of a text in a string

    Jeff Atherton - Friday, March 3, 2017 12:05 PM

    Luis Cazares - Friday, March 3, 2017 11:52 AM

    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: Windowing function puzzle

    Here's an alternative. I'm not sure which would perform better as both have issues that can slow them down.

    WITH CTE AS(
      SELECT ColumnA, ColumnB, OtherData1,...

    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: SQL question ? How can we find all the occurrences of a text in a string

    Jeff Atherton - Friday, March 3, 2017 11:47 AM

    Why do you want to avoid the WHILE loop? I can't see this being...

    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: SQL question ? How can we find all the occurrences of a text in a string

    Here's an option that can be easily converted into an Inline Table-Valued function.

    DECLARE @String AS VARCHAR(100),
       @Search_String AS VARCHAR(100),
       @Ocurrence int;
    ...

    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: What is wrong with trasaction?

    adonetok - Friday, March 3, 2017 9:13 AM

    The reason of using temp tables is for reporters only.

    I'm sorry, but this makes no...

    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: Use date and time in sql statement for join, but not required in the output

    Change the * to include the columns you need separated by commas.
    Avoid using FORMAT as it is very slow and use CONVERT instead.

    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 - 1,501 through 1,515 (of 8,731 total)