Forum Replies Created

Viewing 15 posts - 946 through 960 (of 3,544 total)

  • RE: Query to retrieve a column depending on variable value?

    SELECT pi.ProductId, pi.name, pi.familyName,

    CASE pp.priceAssigned

    WHEN 'listPrice' THEN pi.listPrice

    WHEN 'price1' THEN pi.price1

    WHEN 'price2' THEN pi.price2

    WHEN 'price3' THEN pi.price3

    WHEN 'price4' THEN pi.price4

    WHEN 'price5' THEN pi.price5

    END AS [priceAssigned]

    FROM Customer c

    JOIN ProductPricePerCustomer pp...

  • RE: Precision required

    Hugo Kornelis (3/19/2013)


    David Burrows (3/19/2013)


    Shame they did not extend DATEADD to include a time option 🙁

    They didn't need to. DATEADD has always supported time options.

    Sorry I meant an option to...

  • RE: Precision required

    mtassin (3/14/2013)


    Toreador (3/14/2013)


    Most disappointing. I was sure when I got to the thread I'd see several pages of identical replies saying that it gives an error about assigning variables in...

  • RE: Script to calculate when a job ended.

    You have to cast run_duration to varchar first.

    Try

    STUFF(STUFF(RIGHT('000000'+CAST(run_duration as varchar(6)),6),5,0,':'),3,0,':')

  • RE: Script to calculate when a job ended.

    Jeff Moden (3/11/2013)


    Thank you Mr. Burrows. I learned something new. In the past, I've written just such a function that apparently works the same way. I don't...

  • RE: Are the posted questions getting worse?

    Lynn Pettis (3/11/2013)


    What's wrong with expecting someone who is asking for help with a query to post sample data (regardless of the source of the data)..

    I don't think there was...

  • RE: Script to calculate when a job ended.

    SELECT DISTINCT j.name as job_name,

    msdb.dbo.agent_datetime(run_date, run_time) AS [run_datetime],

    DATEADD(second,DATEDIFF(second,0,msdb.dbo.agent_datetime(19000101, run_duration)),msdb.dbo.agent_datetime(run_date, run_time)) AS [run_endtime]

    FROM msdb..sysjobhistory h

    INNER JOIN msdb..sysjobs j ON h.job_id = j.job_id

    WHERE j.name NOT LIKE 'Backup%'

    AND j.name NOT LIKE 'Cleanup%'

    AND...

  • RE: remove duplicates IF matches

    Brad Marsh (3/10/2013)


    Hi Vinu,

    the excel sheet has both the data output and the expected result from what I am trying to achieve. There are 2 sheets on the excel document....

  • RE: MultiValue Parameter not working

    In which case you will have to produce several sub queries to produce totals as sugggested by pete.

    Simplistically put

    SELECT t.ID,u.Units,v.Initialvisit

    FROM t

    LEFT JOIN (SELECT COUNT(*) AS [Units] FROM [unittable]...

  • RE: MultiValue Parameter not working

    I was thinking more on line of

    SELECT XX.XY, XX.YY, XX.YX

    FROM Properties

    JOIN XX ON XX.RMPROPID = Properties.RMPROPID

    WHERE Properties.RMPROPID IN (@PROPERTIES)

    Which will give you one row per...

  • RE: Update multiple columns in multiple rows

    ryan.mcatee (3/8/2013)


    I think you want something like this?

    or

    UPDATE a

    SET a.[Col 2] = b.[Col 2],

    a.[Col 3] = b.[Col 3],

    a.[Col 4] = b.[Col 4]

    JOIN b ON b.[Col...

  • RE: MultiValue Parameter not working

    peterzeke (3/8/2013)


    ...A single dataset query could be written so that only one row per property is returned...

    +1

  • RE: remove duplicates IF matches

    Adding DISTINCT to the query will give you the results required as per the spreadsheet.

    Two observations.

    1. CaseID has different data type in the two tables, presume this is a typo!

    2....

  • RE: Query to find items purchased from multiple vendors

    Which table contains Vendor_Code ?

  • RE: Need help in Genarating Report

    Add a dataset to the report that queries the ExecutionLog table on the report server and show/hide parts of the report according to the time difference betwen last time the...

Viewing 15 posts - 946 through 960 (of 3,544 total)