Forum Replies Created

Viewing 15 posts - 151 through 165 (of 268 total)

  • RE: Problems with SELF Join

    Assuming correct ordering of the rows !

    And also not taking into account that the data is grouped on O_ID, which must be included in the join criteria.

    /rockmoose

  • RE: Problems with SELF Join

    Ok, Identity columns are only necessary if you don't have a primary key or unique index.

    If you have that there is no point in adding an identity column.

    This got me...

  • RE: Joins - Best Practice

    Cheers Wayne,

    select convert(bigint,0xFFFFFFFFFF)

    -- 1099511627775

    -- only a-z characters (26) char(10)

    select power(convert(bigint,26),10)

    -- 141167095653376

    /rockmoose

  • RE: Problems with SELF Join

    Should be no duplicate data. The sample data was corrupt.

    ( 31175, '2003/11/25 13:08' ) is duplicate in sample.

    CONSTRAINT [PK_FSA_ORDER_CHNG_HIST] PRIMARY KEY  CLUSTERED

     ( [O_ID], [O_TMST] )

    You do have this on...

  • RE: Problems with SELF Join

    Yeah, see this.

    Try:

    select

     outd.O_ID,

     outd.O_TMST,

     isnull(

     ( select ind.To_Dept from dummy ind where ind.O_ID = outd.O_ID

     and ind.O_TMST = (  select max(inind.O_TMST) from dummy inind

        where inind.O_TMST < outd.O_TMST and inind.O_ID = outd.O_ID&nbsp

  • RE: Joins - Best Practice

    ... you will find that you can store many rows in your 4 bytes Int.  If you use a char, you will need a char(10) to hold the same...

  • RE: Joins - Best Practice

    A char(5) consumes 5 bytes, an int 4 bytes. A 32bit processor would be better at comparing 32 bit data than 40 bit data ?

    If you have smaller data the data...

  • RE: Locked cubes - how to unlock without restarting service

    We process a lot of cubes, and sometimes the AS locks up objects, and what do we do ? well we restart the AS .

    I...

  • RE: Problems with SELF Join

    Sometimes subselecting can do the trick:

    select

     outd.O_ID,

     outd.O_TMST,

     isnull(

     ( select ind.To_Dept from dummy ind where ind.O_ID = outd.O_ID

     and ind.O_TMST = (  select max(inind.O_TMST) from dummy inind

        where inind.O_TMST < outd.O_TMST ) ), outd.From_Dept ),

     outd.To_Dept

    from

     dummy...

  • RE: join question

    You might have dirty data. ( especially since You didn't expect duplicates )

    What is the primary key of emp_table ?, and what are the Unique Indexes on emp_table ?.

    Can an...

  • RE: Cube Row Count

    Hi,

    A cube does not have "rows" as such. But the number of rows needed to be read from the database to populate the cube is usually equal to the number...

  • RE: inserting random records

    Hi,

    This is with using newid() as randomizer:

    declare @digits table(nr int)

    insert @digits(nr) select 0 union select 2 union select 4 union select 6 union select 8

    insert @digits(nr) select nr+1 from @digits

    select...

  • RE: sp_executesql with large query Str

    Actually the 8000 bytes length restiction on character datatypes is a restriction on the datatype and not on the representation of the data itself, ( 1 byte per character for...

  • RE: sp_executesql with large query Str

    Hi,

    When using sp_executesql it is more likely that SQL Server will be able to reuse the execution plan of the sql batch (BOL). This I think is only true when there are...

  • RE: sp_executesql with large query Str

    DECLARE @sqlprt1 VARCHAR(8000),@sqlprt2 VARCHAR(8000)

    SET @sqlprt1 = 'SELECT * FROM /*....and long and long...*/'

    SET @sqlprt2 = ' INFORMATION_SCHEMA.COLUMNS /*...and long and long...*/'

    EXECUTE(@sqlprt1+@sqlprt2)

    /rockmoose

Viewing 15 posts - 151 through 165 (of 268 total)