Forum Replies Created

Viewing 15 posts - 121 through 135 (of 356 total)

  • RE: Converting Character to DATETIME

    It depends whether or not you want to convert all the times so that they are relative to the same timezone and are therefore more easily comparable. If so, and...

  • RE: CASE WHEN Column IS NULL

    Jacob Pressures (5/14/2009)


    WEll I've figured out why it is turning it NULL because I'm not returning anything.

    I should have and ELSE that simply returns EmergencyRelation. But i still don't know...

  • RE: Find # of active days based on status records

    This ROW_NUMBER() difference method used to solve the problem of combining sequential rows originated from the following article, or at least that's where I first saw it used.

    http://www.sqlmag.com/Article/ArticleID/93606/sql_server_93606.html

    Suppose we have...

  • RE: convert datetime to integer

    The datetime data type is stored internally as two 4-byte integers concatenated together rather than a true floating point type.

    The first 4-byte integer represents the date portion of the...

  • RE: How to make range for date and count?

    I couldn't reproduce your "joined" data when I ran the following query against your previously supplied base table data (see post on 17th April).

    SELECT S.Start, S.Stop, L.PLCount

    FROM dbo.LTrack L

    ...

  • RE: Find # of active days based on status records

    Here's an alternative method that uses CTE's. It produces the same results as Wayne's quirky update given the OP's test data.

    ConsumerFK ActiveDays

    33 ...

  • RE: Problem: Equal Checksums for different values

    From Books Online:

    "CHECKSUM satisfies the properties of a hash function: CHECKSUM applied over any two lists of expressions returns the same value if the corresponding elements of the two lists...

  • RE: Perform math on string

    Here's an alternative query that uses a method similar to Mike McQueen's to parse the times from the time strings when converted to integers. This method does have the advantage...

  • RE: Calculation of TV Commercial Breaks with SQL2005

    Zeev Kazhdan (4/27/2009)


    Thanks, but adding of

    UNION ALL

    SELECT 1,6,100,1,100,15

    my example will return zero duration for this Top record. This is a place to fix my explanation's mistake - in case...

  • RE: Finding Records with ALL of Several Pieces of Criteria

    I think your problem is solvable using a HAVING clause which ensures that the number of records for each user_id that is returned is equal to the number of model_id...

  • RE: Calculation of TV Commercial Breaks with SQL2005

    I'm not sure if the following really does what you need, but it does reproduce your expected results.

    ;WITH scheduled_commercials AS (

    SELECT 1 AS commercial_break_id,

    ...

  • RE: Function Query

    You can't modify data in base tables from a user defined function.

    If you want to reuse this TSQL you could consider putting it in a stored procedure.

  • RE: Perform math on string

    By converting the time strings to datetime values, you can do the following.

    /* I'm assuming here that @TimeString1 always represents the earlier time and @TimeString2 the later time */

    DECLARE @TimeString1...

  • RE: Counting days with and without an end date

    You could just replace every occurrence of compdte in your query with

    ISNULL(NULLIF(compdte, 0), GETDATE())

    A datetime value of '1900-01-01 00:00:00.000' is 0 (zero) when the datetime is converted to...

  • RE: How to make range for date and count?

    Sorry but I still don't understand your requirements, such as which columns should be counted and which columns should be grouped / binned. Rather than making a guess as to...

Viewing 15 posts - 121 through 135 (of 356 total)