Forum Replies Created

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

  • 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

  • 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...

  • 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...

  • 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 *,

    ...

  • 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...

  • 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...

  • 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...

  • 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...

  • 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.

  • 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.

  • 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...

  • 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....

  • 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...

  • 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...

  • RE: Datetime conversion

    J Livingston SQL (1/29/2016)


    Luis Cazares (1/29/2016)


    Maybe this:

    DECLARE @date varchar(10) = '14-Apr'

    SELECT CONVERT(datetime, '01 ' + RIGHT(@date,3) + ' ' + LEFT(@date,2), 6)

    Hi Luis......why not just use this instead??

    SELECT CONVERT(datetime, '20'+@date)...

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