Forum Replies Created

Viewing 15 posts - 2,101 through 2,115 (of 6,036 total)

  • RE: Update master from detail

    I would not update the master table but set up another "queue" table for approval requests.

    Once a "details" row is updates the coresponding key value is inserted by the trigger...

    _____________
    Code for TallyGenerator

  • RE: Single value MIN and MAX dates from multiple rows

    Replace "Not working" part with this:

    INNER JOIN (

    SELECT PATIENT_ID, MIN(Date_Written) MIN_START, MAX(EXPIRES_ON) MAX_START

    FROM [dbo].[PT_CASE]

    GROUP BY PATIENT_ID ) AS Ptc ON [Pat].[PATIENT_ID] = [Ptc].[PATIENT_ID]

    and simply add MIN_START,...

    _____________
    Code for TallyGenerator

  • RE: What's wrong in this .. simple calculations

    YOu may folow the money :hehe: by tracing intermediate results:

    select (1400.05 / 4232.33 ), (1400.05 / 4232.33 ) * 4180.06, round((1400.05 / 4232.33 ) * 4180.06 ,2) --Statement 1

    declare @v1...

    _____________
    Code for TallyGenerator

  • RE: Time - Adding minutes and seconds

    Steven Willis (3/5/2013)


    Sergiy (3/5/2013)


    Whatever...

    🙂

    These values "10:35","14:22", etc. are from an HTML form and they are posted as strings generated by a hard-coded HTML dropdown with the 5 character pseudo-"time"...

    _____________
    Code for TallyGenerator

  • RE: Time - Adding minutes and seconds

    Steven Willis (3/4/2013)


    As for the time being bound to the date...well, no, not in this case. As I pointed out in the OP the data I'm getting from the application...

    _____________
    Code for TallyGenerator

  • RE: 6 places after decimal without rounding

    Jeff Moden (3/4/2013)


    Considering that you're only working with 6 digits to begin with, consider transposing your formula for a smidgen more accuracy.

    UPDATE dbo.Analysis

    SET AccMargin = ((MArgin+Freight)/Gallons)

    Of course, since you're...

    _____________
    Code for TallyGenerator

  • RE: 6 places after decimal without rounding

    See BOL for descrioption of ROUND function.

    ...

    function

    Is the type of operation to perform. function must be tinyint, smallint, or int. When function is omitted or has a value of...

    _____________
    Code for TallyGenerator

  • RE: Time - Adding minutes and seconds

    Steven Willis (1/2/2013)


    The output was for a golf tournament signup schedule and the end-user needed a column to display tee times. These were actual times of course and not durations....

    _____________
    Code for TallyGenerator

  • RE: JOIN problems

    Sean Lange (3/4/2013)


    Something like this is maybe close.

    SELECT rc.ResultCode,

    COUNT(a.AccountNumber)

    FROM ResultCodes rc

    LEFT OUTER JOIN Accounts a ON rc.ResultCode = a.ResultCode

    left JOIN [Types] t ON a.AccountNumber = t.AccountNumber and t.[Type] = 'MHIC'

    GROUP...

    _____________
    Code for TallyGenerator

  • RE: computed column in view

    Sean Lange (2/27/2013)


    . A view does not store any data so the calculation would not be stored.

    An indexed view does.

    Another name for it is "materialized view" - because all...

    _____________
    Code for TallyGenerator

  • RE: Interesting Question in SQL

    To get unique vaues you just need to group the entries for the columns (that applies to all kind of queries, not only to "FOR XML" ones :hehe: ):

    SELECT a.ID,

    ...

    _____________
    Code for TallyGenerator

  • RE: How compare a list to a table

    There is no need for outer apply here

    DECLARE @string VARCHAR(8000) = '{White,Black,Green}';

    SET @string = REPLACE(REPLACE(@string,'{',''),'}','');

    SELECT Name, ISNULL(Item,'Other') AS Color, IDX

    FROM #testEnvironment a

    LEFT JOIN [dbo].[DelimitedSplit8K](@string,',') b on b.Item =...

    _____________
    Code for TallyGenerator

  • RE: computed column in view

    Sean Lange (2/25/2013)


    .. you would need to add the computed column to your base table.

    or create an indexed view.

    There are requirements to meet though - check BOL for details.

    _____________
    Code for TallyGenerator

  • RE: How to shrink TempDb

    ScottPletcher (2/25/2013)


    But they may need spool space just like any other table or view used multiple times for lookups, etc., yes?

    [I actually don't know if SQL spools go to tempdb...

    _____________
    Code for TallyGenerator

  • RE: How to shrink TempDb

    Running totals:

    http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=93911

    _____________
    Code for TallyGenerator

Viewing 15 posts - 2,101 through 2,115 (of 6,036 total)