Forum Replies Created

Viewing 15 posts - 1,696 through 1,710 (of 8,731 total)

  • RE: How to create error conditions inside function

    Stay away of multi-statement table-valued functions. They're great performance killers.

    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: Renaming fields and combining them into one column

    Keeping Phil's simple formula:

    SELECT name = concat(First_Name, ' ', Last_Name),

    Sports = STUFF(iif(Football = 'Y', '; Football','') + iif(Soccer = 'Y', '; Soccer','') + etc, 1, 2, '')

    FROM YourTable;

    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: Calculating Work Days

    Just a small update.

    --===== If the function already exists, drop it

    IF OBJECT_ID(N'[dbo].[ifn_WorkDays]') IS NOT NULL

    DROP FUNCTION [dbo].[ifn_WorkDays]

    GO

    GO

    ...

    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: Are the posted questions getting worse?

    Michael L John (1/3/2017)


    Just putting the finishing touches on a new reporting server.

    I run this old legacy ETL process that nobody knows about, and nobody remembers, when this error...

    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 to place WITH (NOLOCK) ?

    Chris Harshman (12/30/2016)


    BOR15K (12/30/2016)


    ...I am aware of the dirty data and in this case there will be no update of the data within the selected range, hence I want to...

    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: Anyone here owning up to this...?

    At first I thought it was spam.

    Now, I'm surprised about the real Bobby Tables.:w00t:

    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 to place WITH (NOLOCK) ?

    You also have a TOP 1 without ORDER BY which might return inconsistent results.

    You have a correlated subquery that might return more than one row and would eventually return 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: Find Median

    Jeff Moden (12/30/2016)


    Luis Cazares (12/30/2016)


    It's PERCENTILE_DISC or PERCENTILE_CONT which use OVER to define window and order.

    The median is the first example on the BOL page:

    https://msdn.microsoft.com/en-us/library/hh231327.aspx

    Very cool. Thanks.

    On the two...

    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: Find Median

    It's PERCENTILE_DISC or PERCENTILE_CONT which use OVER to define window and order.

    The median is the first example on the BOL page:

    https://msdn.microsoft.com/en-us/library/hh231327.aspx

    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: Find Median

    Here are 2 other methods that seem to be faster.

    WITH cteStepsTiles AS(

    SELECT *, NTILE(2) OVER(PARTITION BY Rep, MileCode ORDER BY DeltaT) tile

    FROM...

    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 characters that are varchar type going into Excel column as string

    Do you have the Excel column set as Text before inserting the data? That would avoid a numeric format.

    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 (12/29/2016)


    Grumpy DBA (12/29/2016)


    jasona.work (12/29/2016)


    Pig

    Bacon

    Kevin

    McCallister

    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 syntax HELP

    mw112009 (12/29/2016)


    THOM A: I wanted you to modify the code for me.. (Please )

    Never mind!

    Done!

    It works!

    No Help needed.

    Sure, it works. But, do you believe it's efficient? You're reading 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: User defined variable value is not being updated in the Script Task

    Two ideas come to my mind.

    1. You have 2 variables and you're populating one and showing another one (SSIS can cause these confusions).

    2. Your variable wasn't correctly set in 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: SQL beginner needs assistance! ( I know, I know, GREAT! Right?? lol)

    jason.shaw (12/28/2016)


    I need to choose multiple misc. accounts from an account table using a list from one of our accountants and then change to make account active. I am a...

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