Forum Replies Created

Viewing 15 posts - 4,696 through 4,710 (of 26,490 total)

  • RE: Finding continues members SQL Script Question

    Something like this?

    with TestData as (

    select memid, MonthStartDate

    from

    (values

    (123,'2014-01-01'),

    (123,'2014-03-01'),

    (123,'2014-04-01'),

    (123,'2014-05-01'),

    (123,'2014-06-01'),

    (123,'2014-07-01'),

    (123,'2014-08-01'),

    (123,'2014-09-01'),

    (123,'2014-10-01'),

    (123,'2014-11-01'),

    (123,'2014-12-01'),

    (222,'2014-01-01'),

    (222,'2014-02-01'),

    (222,'2014-03-01'),

    (222,'2014-04-01'),

    (222,'2014-05-01'),

    (222,'2014-06-01'),

    (222,'2014-07-01'),

    (222,'2014-08-01'),

    (222,'2014-09-01'),

    (222,'2014-10-01'),

    (222,'2014-11-01'),

    (223,'2014-02-01'),

    (223,'2014-03-01'),

    (223,'2014-04-01'),

    (223,'2014-05-01'),

    (223,'2014-06-01'),

    (223,'2014-07-01'),

    (223,'2014-08-01'),

    (223,'2014-09-01'),

    (223,'2014-10-01'),

    (223,'2014-11-01'),

    (223,'2014-12-01'))dt(memid,MonthStartDate)),

    BaseData as (

    SELECT

    *,

    rn = row_number() over (partition by memid order by MonthStartDate)

    FROM

    ...

  • RE: Are the posted questions getting worse?

    Jack Corbett (8/11/2015)


    Sean Lange (8/11/2015)


    OMG. I just ran across this in a database from a 3rd party. There are actually 50 nvarchar(1) columns with names 1 - 50....

  • RE: Archiving Data Script

    Personally, I'd start with something like this and modify it as needed:

    declare @BatchSize int = 5000, -- change as desired

    @ArchiveDate DateTime =...

  • RE: max not giving the latest one

    lcarrethers (8/10/2015)


    I don't think they want to see any NULL values.

    FYI, the NULL in this INSERT is NOT a null. It is a string whose value is the string...

  • RE: max not giving the latest one

    Also, is the string 'Null' a real Null or a string?

  • RE: max not giving the latest one

    Based on the above sample data, what is the expected results?

  • RE: max not giving the latest one

    lcarrethers (8/10/2015)


    I get this error

    Msg 537, Level 16, State 3, Line 1

    Invalid length parameter passed to the LEFT or SUBSTRING function.

    As I stated, it worked for what you provided. ...

  • RE: Are the posted questions getting worse?

    And Silver Spoon is definitely one of them.

  • RE: max not giving the latest one

    lcarrethers (8/10/2015)


    CREATE TABLE test

    (

    createdon datetime,

    kms_quoteorder varchar(15)

    )

    INSERT INTO test VALUES ('2015-07-22 16:13:39.000','15-37779/Rev7')

    INSERT INTO test VALUES ('2015-07-22 19:54:56.000','15-37779/Rev8')

    INSERT INTO test VALUES ('2015-07-22 20:26:41.000','15-35553/Rev9')

    INSERT INTO test VALUES ('2015-07-22 21:32:31.000','15-35553/Rev10')

    select * from test

    So...

  • RE: Not Exists Linked Server Object Query

    bherbert (8/10/2015)


    So, I've got this query running and it works great providing there is a record in both DataBases. Now, I need to get all of those that have...

  • RE: Can I display all the days in a range even with no data ?

    sgmunson (8/10/2015)


    Luis Cazares (8/10/2015)


    Please don't use a recursive CTE to generate a calendar table as it's only a way of hidden RBAR. You can read more about this on this...

  • RE: Are the posted questions getting worse?

    SQLRNNR (8/10/2015)


    48 bottles of post on the thread, 48 bottles of post.

    Take one down, pass it around, 48 bottles of post on the thread

    ?? Start with 48, take one down,...

  • RE: Fragmented Indexes

    delizat (8/10/2015)


    Lynn Pettis (8/7/2015)


    delizat (8/7/2015)


    Every situation is different, but this is the order of my backup jobs:

    1. Reorganize/Rebuild index

    2. Check integrity

    3. Update Statistics

    4. Backup database.

    Please tell me you aren't updating...

  • RE: 11.2.xxxx vs 11.0.xxxx - What is the difference?

    ebothun (8/7/2015)


    Not a typo. There are lots of references to 11.2 out there, but I see no explanations about differences.

    See http://sqlserverbuilds.blogspot.com/ for example.

    I don't see an 11.2.??.???? on the...

  • RE: Fragmented Indexes

    delizat (8/7/2015)


    Every situation is different, but this is the order of my backup jobs:

    1. Reorganize/Rebuild index

    2. Check integrity

    3. Update Statistics

    4. Backup database.

    Please tell me you aren't updating statistics on indexes...

Viewing 15 posts - 4,696 through 4,710 (of 26,490 total)