Forum Replies Created

Viewing 15 posts - 5,191 through 5,205 (of 8,731 total)

  • RE: Group By RollUp

    That has nothing to do with the rollup. Even if it's considered as a numeric data type, bit data cannot be used in a SUM(), you need to convert it...

  • RE: How to write a SELECT statement to get data from a linked server - I need the SQL syntax please

    You have the schema wrong.

    Select top 100 *

    from casmpogdbspr1.MPOG_Collations.Collation.AsaClass_Cleaned

  • RE: select query works but delete query throws error

    Try this:

    delete a

    from FinancialChanges_DupCk a

    where exists ( Select 1 from FinancialChanges b where a.Number = b.Number and a.Fix = b.Fix and a.AmountType= b.AmountType and a.Amount = b.Amount

  • RE: Swap firstname to lastname

    Slightly shorter version with the same problem as the one from Adam.

    WITH SampleData(fullname) AS(

    SELECT 'Peter Parker' UNION ALL

    SELECT 'Harry Osborn' UNION ALL

    ...

  • RE: convert Stored Procedure to User Defined Function

    As Kevin said, user defined scalar functions and multi-line functions are bad for performance, but inline table-valued functions don't suffer the same problem.

    This code is untested but might give you...

  • RE: Help Needed in Find the Proc

    You need to use a different system view.

    SELECT

    p.name ProcedureName,

    t.TEXT QueryName,

    s.execution_count AS ExecutionCount,

    s.max_elapsed_time AS MaxElapsedTime,

    ISNULL(s.total_elapsed_time / s.execution_count, 0) AS AvgElapsedTime,

    p.modify_date AS LogCreatedOn,

    ISNULL((s.execution_count * 1.)/ DATEDIFF(s, p.modify_date , GETDATE()), 0) AS...

  • RE: change DATE format to DD/MMM/YYYY

    Phil Parkin (2/23/2015)


    Luis Cazares (2/23/2015)


    This is simple and any Oracle forum should give you the answer, but I'll include it here.

    You need to use the TO_CHAR() function to format dates...

  • RE: change DATE format to DD/MMM/YYYY

    This is simple and any Oracle forum should give you the answer, but I'll include it here.

    You need to use the TO_CHAR() function to format dates and TO_DATE() to enter...

  • RE: Select from three tables

    Your LEFT JOIN condition has a problem as both columns belong to CustomerArea. Additional to that, your CustomerArea key seems to consist on 2 columns and you're using just one.

    Try...

  • RE: Help with Script

    Does this return any rows?

    select *

    from orders o

    JOIN stop first_stop on o.first_stop_id = first_stop.id

    JOIN sales s ON o.id = s.reference

    WHERE s.dis IN( 'a', 'b', 'c')

    AND o.status = 'D'

    AND...

  • RE: Help with Script

    s is an alias for the resultset from the apply. It can be anything but I prefer it to be something that could be significant. On the ISNULL column you...

  • RE: Help with Script

    Do you have anything else in the code?

    Did you run the exact same code I posted?

    Note that I changed the JOIN to an APPLY and the column expression for 'Discounts'.

  • RE: Help with Script

    What about this?

    select

    first_stop.actual_departure 'Start'

    , last_stop.actual_departure 'End'

    , last_stop.city_name 'End city'

    , last_stop.state 'End state'

    , last_stop.zip_code 'End zip'

    , first_stop.city_name 'Start city'

    , first_stop.state 'Start state'

    , first_stop.zip_code 'Start zip'

    , datediff (day, last_stop.actual_departure, first_stop.actual_departure) 'Days...

  • RE: Convert mm/dd/yyyy, m/d/yyyy and mm/d/yyyy Date format To Date/datetime (yyyy/mm/dd) in SSIS

    Different approach:

    Just cast the column as a date and use the error output to ignore the column when it's not a valid date.

    This was my test file:

    ID,Date

    1, 12/19/2014

    2, 1/5/2015

    3, 11/6/2014

    4,...

  • RE: Convert mm/dd/yyyy, m/d/yyyy and mm/d/yyyy Date format To Date/datetime (yyyy/mm/dd) in SSIS

    I'm sorry, I didn't read that last part. I'll blame the lack of coffee.

    Leaving your flat file column as a string, you could use a conditional to generate null values...

Viewing 15 posts - 5,191 through 5,205 (of 8,731 total)