Forum Replies Created

Viewing 15 posts - 361 through 375 (of 444 total)

  • RE: Overlapping Time Spans Query

    So try

    SELECT DISTINCT

    t1.id,

    t1.empid,

    t1.jobnum,

    t1.opcode,

    t1.starttime,

    t1.finishtime,

    t2.id id2,

    t2.empid empid2,

    t2.jobnum jobnum2,

    t2.opcode opcode2,

    t2.starttime starttime2,

    t2.finishtime finishtime2

    FROM

    vGSL_DMTEpicorData t1 inner join

    vGSL_DMTEpicorData t2

    on t1.jobnum=t2.jobnum and

    t1.empid=t2.empid and

    (

    t1.starttime < t2.finishtime and

    t2.starttime <...

  • RE: simple xml to table

    🙂

    Alternatively use OPENXML

    DECLARE @xmlDocument nvarchar(max)

    SET @xmlDocument = N'<table>

    <tr>

    <td>cell1</td>

    <td>cell2</td>

    <td>cell3</td>

    </tr>

    <tr>

    ...

  • RE: Overlapping Time Spans Query

    Symmetric condition , i mean for two intervals, just dates for example, (2014-10-30, 2104-11-02) and (2014-10-29, 2014-11-03) no matter which is t1 and which is t2 symmetric intersection condition...

  • RE: Overlapping Time Spans Query

    Yep, overlapping condition ... Generaly, overlapping means

    t1.starttime < t2.finishtime AND t2.starttime < t1.finishtime

    i.e those intervals have at least one common point. And this condition is symmetric.

    Sorry, haven't...

  • RE: Overlapping Time Spans Query

    Provided Id is unique just add

    AND t1.ID < t2.ID

    to ON clause.

  • RE: Formatted output

    Nice question.

    raulggonzalez (10/29/2014)

    The reason why uses DATALENGTH is because the column is DEFINED as NVARCHAR()

    Really, it doesn't matter because SQL Server stores XML data in Unicode (UTF-16)...

  • RE: Primary key vs Unique key

    Hugo Kornelis (10/28/2014)

    One NULL is correct for a single-column constraint, not for composite. A better way to phrase it is that a UNIQUE constraint allows NULLs (as per ANSI standard),...

  • RE: Primary key vs Unique key

    Koen Verbeeck (10/28/2014)


    serg-52 (10/28/2014)


    "only one null " is someway misleading. Precisley it's a "only one null value per column".

    If the unique index is not a filtered index 😉

    It's another point...

  • RE: Primary key vs Unique key

    "only one null " is someway misleading. Precisley it's a "only one null value per column".

  • RE: Detect / Determine data stored in a varbinary field

    Looks like it's "5. etc....", numbers packed by some app somehow and only those app developer can tell you which way a BLOB should be decoded.

  • RE: Aggregate Query Help Required

    Kind of

    declare @groups table (

    id int,

    gname varchar(10)

    );

    insert @groups values

    (1,'Dividend')

    ,(2,'Dividend')

    ,(3,'Dividend')

    ,(4,'Divisor')

    ,(5,'Divisor')

    ,(6,'Divisor')

    ,(7,'Divisor')

    ;

    select [Period], sum(case gname when 'Dividend' then [Score] end) / sum(case...

  • RE: Search Millions of Column Values in Another Column

    May be home made email index will have better perfomance.

    Use regexp using CLR or sp_OACreate 'VBScript.RegExp' to build a

    #mailIndex (OriginalRowId, Pos, Mail). Build index and join with the...

  • RE: File Size from T-SQL

    You may want to create SQLCLR TVF proc returnig file list with poperties see sample code http://www.sqlservercentral.com/articles/SQLCLR/65656/

  • RE: Help with an OR query

    Full text is just the option designed for what you are looking for http://technet.microsoft.com/en-us/library/ms142571(v=sql.105).aspx

  • RE: Is there a way to enforce the use of a where clause in a select?

    Quite possible a business rule exists, allowing users query DB with no filters set. And there're users and users. So it's a management problem really. Teach users or buy...

Viewing 15 posts - 361 through 375 (of 444 total)