Forum Replies Created

Viewing 15 posts - 511 through 525 (of 1,923 total)

  • RE: Most Occuring value in a column

    Going through the example again adding extra data, ( new sample has Name1 and name2 appearing 5 times each), here is the code

    DECLARE @Table TABLE

    ( ColVal VARCHAR(10) )

    INSERT INTO @Table...

  • RE: Most Occuring value in a column

    Jeff Moden (2/18/2012)


    "Use the Force, Luke!"

    Although the execution plans are identical and the performance is likely identical, as well, sometimes the "old ways" lead to simpler code. Don't forget...

  • RE: Most Occuring value in a column

    Mind you, the above query works only if u have single value out of the table ; if u have multiple-qualifying rows, then we must use another method!

    {Edit - Gosh,...

  • RE: Most Occuring value in a column

    This?

    DECLARE @Table TABLE

    ( ColVal VARCHAR(10) )

    INSERT INTO @Table (ColVal)

    SELECT 'name1'

    UNION ALL SELECT 'name2'

    UNION ALL SELECT 'name3'

    UNION ALL SELECT 'name1'

    UNION ALL...

  • RE: To delete or update duplicate reords in a table.

    Please follow this article and provide us more information on what you need.

    http://www.sqlservercentral.com/articles/Best+Practices/61537/

  • RE: To delete or update duplicate reords in a table.

    Change select pid, CN, mk, te, yr, st, cr, cc from to select pid from

    You cant throw multiple values values from a subquery while u use in WHERE clause....

  • RE: Conversion Failed Error

    Jeremy... (2/17/2012)


    "2012-01-01 10:12:03.090" vs "Jan 13 2012 2:20AM".

    Is there anyway for this to work while keeping dates looking the same?

    This?

    CASE WHEN (

    SELECT MIN(dbo.GetLocalDateTimeFunc(FA2.ReceivedDate))

    FROM FileActions FA2

    WHERE FA2.ActionDefID...

  • RE: Truncate VS drop

    PaulB-TheOneAndOnly (2/17/2012)


    Have you ever hammered a screw?

    If the screw is tapered and should have a sharp point, then yes 😀

    PaulB-TheOneAndOnly (2/17/2012)


    it works but doesn't look professional, init?

    Totally agree!

  • RE: Truncate VS drop

    PaulB-TheOneAndOnly (2/17/2012)


    What tool would you use to screw togheter two pieces of wood? a hammer or a screwdriver?

    Both the tools bond 2 pieces of wood.

    I would ask "What...

  • RE: Conversion Failed Error

    so your new code will be (changes in bold)

    CASE WHEN (

    SELECT MIN(dbo.GetLocalDateTimeFunc(FA2.ReceivedDate))

    FROM FileActions FA2

    WHERE FA2.ActionDefID IN (66,64,391) --Docs Sent To Record Actions

    AND FA2.ReceivedDate IS NOT NULL

    AND FA2.FileID = FM.FileID

    ...

  • RE: Conversion Failed Error

    And read about data-type precedence here : MSDN

    The values retruned by each expression in CASE will be matched will be converted to the highest data-type in the precedence list!

    Thus...

  • RE: Conversion Failed Error

    Run these following statements, you will know!!

    select case when 1 = 1 then GETDATE()

    when 2 =...

  • RE: Minimal Logging and BULK

    Evil Kraig F (2/16/2012)


    ColdCoffee (2/16/2012)


    How about this?

    1. Create a new database in another server with only one table that matches your source table

    2. BCP out data from your source table...

  • RE: Minimal Logging and BULK

    How about this?

    1. Create a new database in another server with only one table that matches your source table

    2. BCP out data from your source table to a file

    3. Copy...

  • RE: Returning Multiple Results from Case Statement

    Glad it worked.

Viewing 15 posts - 511 through 525 (of 1,923 total)