Forum Replies Created

Viewing 15 posts - 1,906 through 1,920 (of 10,144 total)

  • RE: Are the posted questions getting worse?

    From some time yesterday through to the present I've been noticing something a little odd. In the workplace, on the commute home last night (the walk, the tube, the train),...

  • RE: Are the posted questions getting worse?

    Brandie Tarvin (11/16/2015)


    Lynn Pettis (11/16/2015)


    Sorry, got snippy with an OP.

    50 lashes with a noodle please.

    My Patented Wet Noodle <tm> no less. Shame.

    EDIT: BTW, I'm teasing you, Lynn.

    Oh gosh, how 50...

  • RE: Help with query that group consecutive records based on a field value

    Thanks for posting up sample data - it makes this so much easier.

    Try this query for starters:

    SELECT

    Qty = COUNT(DISTINCT serial),

    [Type] = modelo,

    DateFrom = MIN([date]),

    DateTo = MAX([date])...

  • RE: Primary key and unique indexes question

    MaxJam (11/16/2015)


    Thanks all for your help, I have created a clustered primary key on the three columns and added 2 unique indexes on the 2 pairs and tested it.

    ...

    This is...

  • RE: Get previous row's value - with a twist!

    mm7861 (11/16/2015)


    Sample data attached.

    The first tab shows the raw data. Asset ID 1 was purchased on 13/11/2015 and sold on 16/11/2015. This is why the only rows that exist are...

  • RE: Get previous row's value - with a twist!

    mm7861 (11/16/2015)


    Hi all,

    I have a scenario where I am dealing with assets. Every business day we get a new asset value. I need a dataset that shows the current asset...

  • RE: Primary key and unique indexes question

    The first and second examples would violate the unique constraint you already have. Are you looking to replace your existing unique constraint on vhid, or implement the new rules alongside?

  • RE: Assigning TOP 1 value to a variable in a stored procedure

    destino (11/16/2015)


    No reason specifically. I started with some pseudo code given to me by the client and it just went from there.

    It runs in less than 1 second and shouldn't...

  • RE: Aligning 2 rows into 1 row

    Try this. It won't be far off:

    SELECT

    MIN(s.created) loginDateTime,

    MAX(s.updated) logoutDateTime,

    UPPER(s.appName) appName,

    CAST(s.created AS DATE) createdDate,

    UPPER(s.userName) userName,

    x.IDlist

    FROM a_Session s

    CROSS APPLY (

    SELECT IDlist = STUFF(

    (SELECT ',' + r.id...

  • RE: Aligning 2 rows into 1 row

    There's a standard method for this: FOR XML PATH string concatenation. But first, can you run through this derivative of your query and replace the question marks with the correct...

  • RE: HELP WITH A CASE STATEMENT

    Here's another way:

    SELECT

    co.ContactGroupRef,

    co.ContactId,

    co.RelationshipToLead,

    [RelatedContactId] = a.ContactId

    FROM #Contact co

    OUTER APPLY (

    SELECT ContactId

    FROM #Contact ci

    WHERE ci.ContactGroupRef = co.ContactGroupRef

    AND ci.ContactId <> co.ContactId

    AND ci.RelationshipToLead = 'Lead Tenant'

    ) a

  • RE: Conversion failed when converting character string to smalldatetime data type.

    DECLARE

    @BaseYrBegin CHAR(8), -- use the correct data type

    @sql NVARCHAR(100)

    SET @BaseYrBegin = '20140101' -- use an unambiguous date string

    SET @sql = 'SELECT datepart(year,''' + @BaseYrBegin + '''' +...

  • RE: Are the posted questions getting worse?

    Ed Wagner (11/12/2015)


    Sean Lange (11/12/2015)


    Jack Corbett (11/12/2015)


    Sean Lange (11/12/2015)


    Brandie Tarvin (11/12/2015)


    Sean Lange (11/12/2015)


    djj (11/12/2015)


    Grant Fritchey (11/12/2015)


    Still, could be fun. Build out a nested CTE inside a function, use...

  • RE: Customers with the total sales, who placed an order last year but not this year.

    ChrisM@Work (11/12/2015)


    nexus2vijay (11/12/2015)


    Hi Friends,

    I have a table with 2 columns Version and CurrentDateTime

    For every insert the Records should be Autoincrement for Version Column and Record Insertdatetime for that Version

    1.0 |...

  • RE: Insert statement: Auto Increment with Version Number and Datetime

    nexus2vijay (11/12/2015)


    Hi Friends,

    I have a table with 2 columns Version and CurrentDateTime

    For every insert the Records should be Autoincrement for Version Column and Record Insertdatetime for that Version

    1.0 | 2015-11-12...

Viewing 15 posts - 1,906 through 1,920 (of 10,144 total)