Forum Replies Created

Viewing 15 posts - 6,271 through 6,285 (of 8,753 total)

  • RE: Rank on repeating groups of bit field

    Jim Shaffer (1/16/2015)


    Lets say I have some data where a bit value changes over time and I want to rank it by the repeating groups, how do I write the...

  • RE: Run NewID() multiple times

    Still further on the subject, here is a table value function spawned by Lynn's function

    😎

    USE tempdb;

    GO

    create view dbo.MyNewID as

    select newid() as NewIDValue;

    go

    CREATE FUNCTION dbo.ITVFN_DO_SHAKESPEARE

    (

    @BATCHSIZE INT...

  • RE: Tipping point for a numbers table vs inline tally

    Jeff Moden (1/16/2015)


    Eirikur Eiriksson (1/16/2015)


    Jeff Moden (1/16/2015)


    sqldriver (1/16/2015)


    You guessed right on the seconds 🙂

    "Lawyers" and their "billable hours"; we should all be so lucky.

    Oh my word! That's bloody well...

  • RE: Run NewID() multiple times

    Stefan Krzywicki (1/16/2015)


    Thanks, but there's a part I'm not sure I get. What's the

    FROM T T1,T T2,T T3,T T4,T T5,T T6,T T7

    for? How does that work?

    The "seed" for the...

  • RE: Run NewID() multiple times

    Further on this, if you want more normal looking text then something like this might help

    😎

    DECLARE @BATCHSIZE INT = 255;

    DECLARE @ROWCOUNT INT = 10000;

    ;WITH T(N) AS (SELECT N FROM...

  • RE: Run NewID() multiple times

    Quick alteration of the code, changed to set based double loop, the trick is to a add variations to the inner loop

    😎

    DECLARE @BATCHSIZE INT = 255;

    DECLARE @ROWCOUNT INT =...

  • RE: Tipping point for a numbers table vs inline tally

    Jeff Moden (1/16/2015)


    sqldriver (1/16/2015)


    You guessed right on the seconds 🙂

    "Lawyers" and their "billable hours"; we should all be so lucky.

    Oh my word! That's bloody well insane. :hehe: Do...

  • RE: Row Counts Based on Distinct Values from Multiple Tables

    For fun, few different counts/metrics

    😎

    USE tempdb;

    GO

    SET NOCOUNT ON;

    ;with UnionTables as

    (

    SELECT CAST(TestDateTime AS Date) TestDate,

    SerialNumber,

    TestType

    FROM Coat

    UNION ALL

    SELECT CAST(TestDateTime AS Date) TestDate,

    SerialNumber,

    TestType

    FROM Cutoff

    UNION ALL

    SELECT CAST(TestDateTime AS Date) TestDate,

    SerialNumber,

    TestType

    FROM Geo

    UNION ALL

    SELECT CAST(TestDateTime AS...

  • RE: Tipping point for a numbers table vs inline tally

    sqldriver (1/15/2015)


    Yeah, I just do this and replace the TOP with whatever target number.

    USE tempdb

    DECLARE @cntr BIGINT = 0;

    ;WITH T(N) AS (SELECT N FROM (VALUES (NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL)) AS X(N))

    ,NUMS(N) AS...

  • RE: Row Counts Based on Distinct Values from Multiple Tables

    Many ways of doing this, here is one

    😎

    USE tempdb;

    GO

    SET NOCOUNT ON;

    DECLARE @SAMPLE_DATA TABLE

    (

    [Date] DATE ...

  • RE: Are the posted questions getting worse?

    Koen Verbeeck (1/14/2015)


    Luis Cazares (1/14/2015)


    Congratulations Koen! When I grow up I want to be like you. :hehe:

    Action figures will soon be available! 😎

    Certainly there is a branded Witbier on it's...

  • RE: Is there a better way to write this query.

    Quick though, unless you have an under-performing/resource starved system, 10000 sounds like a very small number for an insert batch size, any particular reason for this number? Cannot see it...

  • RE: MIN across multiple columns with a GROUP BY

    kiran 4243 (1/13/2015)


    Hi,

    How to get the lowest U.Price along with FX and Rate.

    ID-U.Price-FX-Rate

    1280 19.1196 EUR 3.85

    1280 46.2462 USD 3.63

    1280 6.32 RM 1.00

    Required output.

    ID-U.Price-FX-Rate

    1280...

  • RE: Are the posted questions getting worse?

    Koen Verbeeck (1/13/2015)


    FYI, I received the Author of the Year award at MSSQLTips.com!

    Thanks everyone for voting!

    Congratulations, good job and well done, justly deserved I would say!

    😎

  • RE: How to add missing IDs in a SQL table?

    srinivas.akyana (1/12/2015)


    Hello,

    I have a scenario where I would need to add +4 IDs with the existing IDs, below is an example:

    IDWorkloadUnits

    1EXO 3

    7SPO ...

Viewing 15 posts - 6,271 through 6,285 (of 8,753 total)