Forum Replies Created

Viewing 15 posts - 3,436 through 3,450 (of 8,731 total)

  • RE: Find and Remove Duplicate Records SQL Server

    marquito_61 (2/2/2016)


    But this method eliminates all duplicate records

    that is wrong

    As far as I know, none of the code posted in the article of the forum eliminates all rows with duplicates,...

    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!

    Ed Wagner (2/2/2016)


    Grumpy DBA (2/2/2016)


    djj (2/2/2016)


    Ed Wagner (2/2/2016)


    BWFC (2/2/2016)


    Ed Wagner (2/2/2016)


    Grumpy DBA (2/2/2016)


    Ed Wagner (2/2/2016)


    HappyGeek (2/1/2016)


    Ironside

    Constitution

    HMS Guerriere

    Battle

    Abbey

    Road

    Hog

    Razorback

    Racegun

    Race pod

    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: Pull string between a certain string and a tab (char(9))

    You just need a combination of SUBSTRING and CHARINDEX. Be sure to consider the possibility of strings missing Requestor: or char(9) or both.

    If you want help with the code, please...

    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: Update with CASE?

    M Joomun (2/2/2016)


    Sean Lange (2/2/2016)


    M Joomun (2/2/2016)


    I have a variable, TempQuarterlyPeriod, which has values 1, 2, 3 or 4. Based on the contents of TempQuarterlyPeriod I want to update 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: Update with CASE?

    A bit simpler than the code posted by John. The FROM part is only generating sample data and it's not really a part of the solution.

    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: Find and Remove Duplicate Records SQL Server

    o.kaesmann (2/2/2016)


    My faforite method to clean-up duplicated rows is this (I used the example code from above):

    That's certainly interesting. I've never heard of %%physloc%% before and for a moment I...

    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 and Remove Duplicate Records SQL Server

    The problem is that you're missing an important option that SQL Server offers: The possibility to modify data through CTEs and views as long as they follow certain rules (Check...

    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 and Remove Duplicate Records SQL Server

    venkataprasanth (2/1/2016)


    The author's posted solution works and it DOESN'T DELETE ALL Duplicates. (If there are 3 dup rows it deletes 2 and leaves 1). So it works. Also I guess...

    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: select with a while loop

    It could be as simple as having a calendar table with holidays and workdays included. Then the query would come like this:

    SELECT COUNT(*)

    FROM Calendar

    WHERE cal_date BETWEEN @start AND @End

    AND...

    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 and Remove Duplicate Records SQL Server

    Even the method posted on Microsoft Support is better than this ugly RBAR option with a deprecated feature.

    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: COALESCE

    palotaiarpad (1/31/2016)


    Hmm. I thought COALESCE will return the datatype of the leftmost parameter. Learnt something. Thanks.

    ISNULL() does work that way.

    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: Make Rows to a Column

    yb751 (1/29/2016)


    J Livingston SQL (1/29/2016)


    nice....but when there is an unknown number of values, how does the dynamic sql work?

    LOL...yeah now that you mention it, that would be a complete pain...

    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 we delay the execution?Or ReWrite this Query?

    Do you mean inserting one row, then waiting a moment before inserting a new row, then insert the following row all in the same statement?

    If so, then it's not possible....

    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 can I convert char field to be used for calculation?

    mbatchelor (1/29/2016)


    I am trying to use a char field in a calculation with no success. Here is my sql:

    SELECT REG_CONFIG.CUR_YR_DFLT

    ,SECTION_MASTER.YR_CDE

    ,CAST(ROUND(REG_CONFIG.CUR_YR_DFLT - 1,0) AS int) AS NEWYEAR

    ,CONVERT(INT,SECTION_MASTER.YR_CDE) AS...

    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: Datetime conversion

    J Livingston SQL (1/29/2016)


    fair enough...see your (very valid) point. but why use "CONVERT" instead of "TRY_CONVERT"? (2012 forum)

    Thanks

    Bad practice. I didn't see it was a 2012 forum and...

    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 - 3,436 through 3,450 (of 8,731 total)