Forum Replies Created

Viewing 15 posts - 16 through 30 (of 1,244 total)

  • Reply To: Case and When Query

    If that's what is coming out of ChatGPT, then my job is still safe for the time being.

    All 3 of CGPT queries are doing an update of the entire table,...

  • Reply To: Random Number Generating

    Jeff Moden wrote:

    I just wanna know what he actually wants. 😀

    Ditto!

  • Reply To: Random Number Generating

    LOL.. He also wants "random" and "unique"... Given that any randomly generated number always has the potential to collide with another randomly generated number, the base requirements are a contradiction...

  • Reply To: Master Data - Hierarchies Creation, Change and Maintenance

    This is a big topic... To big for a simple forum reply. So rather that dive into details, I would suggest you start with an "adjacency list" model. For example,...

  • Reply To: Random Number Generating

    Jeff Moden wrote:

    p.s.  This is really going to be fun when they need another 10 million unique random values to fold into the first 10 million. 😀

    It shouldn't be too bad...

  • Reply To: Random Number Generating

    Jeff Moden wrote:

    And, welcome back!

    Thanks Jeff... I've haven't actually gone anywhere. I just do more reading than posting these days (mostly due to reading on an iOS devise).

    Every once in awhile,...

  • Reply To: Random Number Generating

    I read it as "the number should be between 10 and 15 digits in length and the first two digits must be 11".

    Some clarification from the OP would be helpful.

  • Reply To: Random Number Generating

    Something like this...

    WITH 
    cte_n1 (n) AS (SELECT 1 FROM (VALUES (1),(1),(1),(1),(1),(1),(1),(1),(1),(1)) n (n)),-- 10
    cte_n2 (n) AS (SELECT 1 FROM cte_n1 a CROSS JOIN cte_n1 b),-- 100
    cte_n3 (n)...
  • Reply To: Random Number Generating

    Jeff Moden wrote:

    sathishkm wrote:

    reduce the length to

    The numbers should begin with 11. The minimum length of the number should be 10 The maximum length of the number should be 15 Need...

  • Reply To: Question related to functions

    Generally speaking… Yes, you can create functions in the master database and referent them from any other database using the 3 part, fully qualified name.

    That said, if the function definition...

  • Reply To: The Temp Alias

    You are 100% correct Jeff. Complete brain fart on my part. Please disregard my previous comment.

  • Reply To: The Temp Alias

    You could create a separate stored procedure that accepts a spid as an input parameter.

    The stored proc would be a simple WAITFOR command that waits for a period of time...

  • Reply To: The VALUES Limit

    The question is still technically "ambiguous" given that the following also works...

    CREATE TABLE #TestData (
    int_val int NOT NULL
    );

    INSERT #TestData (int_val)
    SELECT
    tvc.int_val
    FROM
    ( VALUES
    (1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(11),(12),
    ...
    (1189),(1190),(1191),(1192),(1193),(1194),(1195),(1196),(1197),(1198),(1199),(1200)
    ) tvc (int_val);
  • Reply To: The VALUES Limit

    Oh, I get that.  Just every once in a while, you want to put something together for a "one-off what-if" and thing like this come in handy.

    Agreed.

  • Reply To: The VALUES Limit

    Just keep in mid that, "just because you can, doesn't mean you should"... Super long value lists can really eat up compile memory and compile time.

    If you want to additional...

Viewing 15 posts - 16 through 30 (of 1,244 total)