Forum Replies Created

Viewing 15 posts - 586 through 600 (of 2,462 total)

  • RE: Repetitive Tasks Please Help on Populating Table

    This is a job for a tally table[/url]!

    Here's a crash course on how they work. Run this:

    SELECT ROW_NUMBER() OVER (ORDER BY (SELECT NULL))-1 FROM

    (VALUES (0),(0),(0),(0),(0),(0),(0),(0),(0),(0)) a(x), -- 10

    (VALUES...

    "I cant stress enough the importance of switching from a sequential files mindset to set-based thinking. After you make the switch, you can spend your time tuning and optimizing your queries instead of maintaining lengthy, poor-performing code."

    -- Itzik Ben-Gan 2001

  • RE: URGENT Please -Substring Formation in SQL SERVER 2014

    Another couple options:

    1. You can use DigitsOnlyEE[/url]. This exactly the type of task it was designed for (note my comments):

    -- How to use dbo.DigitsOnlyEE

    SELECT DigitsOnly FROM dbo.DigitsOnlyEE('Recalc 2015659341589653');

    SELECT DigitsOnly FROM...

    "I cant stress enough the importance of switching from a sequential files mindset to set-based thinking. After you make the switch, you can spend your time tuning and optimizing your queries instead of maintaining lengthy, poor-performing code."

    -- Itzik Ben-Gan 2001

  • RE: How do I add a constraint to a column

    ALTER TABLE employees

    ADD CONSTRAINT check_length

    CHECK (LEN(fieldname) < 1)

    Should be

    ALTER TABLE employees

    ADD CONSTRAINT check_length

    CHECK (LEN(fieldname) = 1)

    But this could be handled by using a nullable char(1) data type:

    ALTER TABLE employees

    ALTER...

    "I cant stress enough the importance of switching from a sequential files mindset to set-based thinking. After you make the switch, you can spend your time tuning and optimizing your queries instead of maintaining lengthy, poor-performing code."

    -- Itzik Ben-Gan 2001

  • RE: Background Color Expression

    PB _BI touched on this...

    I'm assuming you're attempting to use that expression in a text box properties/color setting... you can put a color or expression in there. if it...

    "I cant stress enough the importance of switching from a sequential files mindset to set-based thinking. After you make the switch, you can spend your time tuning and optimizing your queries instead of maintaining lengthy, poor-performing code."

    -- Itzik Ben-Gan 2001

  • RE: The Remote DBA

    mjh 45389 (7/19/2016)


    Sadly I have encountered one to many people who believe knowledge is power and keep things to themselves. If they do not end up leaving they often morph...

    "I cant stress enough the importance of switching from a sequential files mindset to set-based thinking. After you make the switch, you can spend your time tuning and optimizing your queries instead of maintaining lengthy, poor-performing code."

    -- Itzik Ben-Gan 2001

  • RE: The Remote DBA

    I have been working from home part of, or most of the time, since 2009. First as a DBA for remote clients and since 2011 as a BI Person. I...

    "I cant stress enough the importance of switching from a sequential files mindset to set-based thinking. After you make the switch, you can spend your time tuning and optimizing your queries instead of maintaining lengthy, poor-performing code."

    -- Itzik Ben-Gan 2001

  • RE: Odd (to me) Behavior with NTILE() and NULL Values in Source Data

    Jeff Moden (7/13/2016)


    Alan.B (2/25/2016)


    The NTally Inline Table Valued Function

    N-I-I-I-I-C-E! Great documentation, too!

    Thank you, thank you! I thought you might like that ;-).

    "I cant stress enough the importance of switching from a sequential files mindset to set-based thinking. After you make the switch, you can spend your time tuning and optimizing your queries instead of maintaining lengthy, poor-performing code."

    -- Itzik Ben-Gan 2001

  • RE: Simple CLR request

    Solomon Rutzky (7/14/2016)


    CELKO (7/14/2016)


    Can you explain why you think this kind of programming and systems design would result in lower cost, easier maintenance or any other advantage?

    -1

    +1

    "I cant stress enough the importance of switching from a sequential files mindset to set-based thinking. After you make the switch, you can spend your time tuning and optimizing your queries instead of maintaining lengthy, poor-performing code."

    -- Itzik Ben-Gan 2001

  • RE: Simple CLR request

    [Quote]Jeff Moden (7/13/2016)


    Alan.B (7/13/2016)


    CELKO (7/13/2016)


    -1 is a wonderful answer. Mixed systems (those with more than one language embedded in each other) are always inefficient and a nightmare for anyone to...

    "I cant stress enough the importance of switching from a sequential files mindset to set-based thinking. After you make the switch, you can spend your time tuning and optimizing your queries instead of maintaining lengthy, poor-performing code."

    -- Itzik Ben-Gan 2001

  • RE: Generate Repeating Set of Row_Number values

    Note that Jeff's second solution will sort the results in the order you demonstrated in your original post. The NTILE solution would not. If you need the numbers in that...

    "I cant stress enough the importance of switching from a sequential files mindset to set-based thinking. After you make the switch, you can spend your time tuning and optimizing your queries instead of maintaining lengthy, poor-performing code."

    -- Itzik Ben-Gan 2001

  • RE: Sequential Numbers Joined to Serial Number Table

    Alternatively you can do it like this:

    WITH

    E(n) AS(

    SELECT n FROM (VALUES(0),(0),(0),(0),(0),(0),(0),(0),(0),(0))E(n)

    ),

    E2(n) AS(

    SELECT a.n FROM E a, E b

    ),

    E4(n) AS(

    ...

    "I cant stress enough the importance of switching from a sequential files mindset to set-based thinking. After you make the switch, you can spend your time tuning and optimizing your queries instead of maintaining lengthy, poor-performing code."

    -- Itzik Ben-Gan 2001

  • RE: Microsoft SQL Developer Certification For beginers

    Start with: Querying Microsoft SQL Server 2012/2014.

    Buy the exam book. Study it and practice the coding related to the subject matter one chapter at a time. Once you feel that...

    "I cant stress enough the importance of switching from a sequential files mindset to set-based thinking. After you make the switch, you can spend your time tuning and optimizing your queries instead of maintaining lengthy, poor-performing code."

    -- Itzik Ben-Gan 2001

  • RE: Simple CLR request

    CELKO (7/13/2016)


    -1 is a wonderful answer. Mixed systems (those with more than one language embedded in each other) are always inefficient and a nightmare for anyone to read or maintain....

    "I cant stress enough the importance of switching from a sequential files mindset to set-based thinking. After you make the switch, you can spend your time tuning and optimizing your queries instead of maintaining lengthy, poor-performing code."

    -- Itzik Ben-Gan 2001

  • RE: Simple CLR request

    CELKO (7/12/2016)


    -1 is a wonderful answer.

    To what? Who are you trying to communicate with here?

    Mixed systems (those with more than one language embedded in each other) are always in...

    "I cant stress enough the importance of switching from a sequential files mindset to set-based thinking. After you make the switch, you can spend your time tuning and optimizing your queries instead of maintaining lengthy, poor-performing code."

    -- Itzik Ben-Gan 2001

  • RE: Simple CLR request

    Solomon Rutzky (7/9/2016)


    Alan.B (7/7/2016)


    Ok Solomon, I tried to figure this out and failed. Forgive my CLR noobness (I create about 1 CLR/year) and I'm sure this is simple but I'm...

    "I cant stress enough the importance of switching from a sequential files mindset to set-based thinking. After you make the switch, you can spend your time tuning and optimizing your queries instead of maintaining lengthy, poor-performing code."

    -- Itzik Ben-Gan 2001

Viewing 15 posts - 586 through 600 (of 2,462 total)