Forum Replies Created

Viewing 15 posts - 8,071 through 8,085 (of 8,731 total)

  • RE: Stored proc exit

    It's really easy

    select @Count1=count(*) from [test] where [testcol] = 10

    select @Count2=count(*) from [test1] where [testcol] = 10

    IF @Count1<=0 AND @Count2<=0

    BEGIN

    -- Your SP code here

    END

  • RE: More efficient way to iterate through table rows to perform Update

    Also, you need to define more the logic you're using because you haev some possible flaws in your code and I see no reason to go row by (agonizing) row.

    A...

  • RE: Combine columns into One with Delimiter

    Jeff Moden (6/6/2013)


    Luis Cazares (6/6/2013)


    How come neither of us got that simple and effective solution? I need to go back to practice the KISS mantra.

    BWAAA-HAAA!!! I have null idea of...

  • RE: slowly changing dimension?

    I have a solution for you that will get the result for a player with 3 consecutive games with the same score.

    drop table #gamescores

    create table #gamescores

    (gameNo varchar(20) not null,

    player varchar...

  • RE: slowly changing dimension?

    josh.granville (6/7/2013)


    polkadot (6/7/2013)


    Hi everyone.

    I've got to figure out whose games scores changed the least over time. I've created DDL to illustrate

    create table gamescores

    (gameNo varchar(20) not null,

    player varchar (20) not null,

    score...

  • RE: Money not accepted a datatype

    Aren't you missing the @ on your variable declaration?

    DECLARE @BalanceDue money, @ktr int

  • RE: Combine columns into One with Delimiter

    Jeff Moden (6/6/2013)


    Luis Cazares (6/6/2013)


    Sean Lange (6/6/2013)


    Here is another:

    select stuff(isnull(col1 + '/', '') + isnull(col2 + '/', ''), LEN(isnull(col1 + '/', '') + isnull(col2 + '/', '')), 1, '')

    from Table_1

    Sean,...

  • RE: Fizz Buzz interview questions for phone screens?

    Luis Cazares (6/6/2013)


    ScottPletcher (6/6/2013)


    Sean Lange (6/6/2013)


    ScottPletcher (6/6/2013)


    Ask them::

    Given table1 with columns "id" and "value", where each id has 1 to 3 values/rows in the table:

    Describe the essentials of a single...

  • RE: Fizz Buzz interview questions for phone screens?

    ScottPletcher (6/6/2013)


    Sean Lange (6/6/2013)


    ScottPletcher (6/6/2013)


    Ask them::

    Given table1 with columns "id" and "value", where each id has 1 to 3 values/rows in the table:

    Describe the essentials of a single query (no...

  • RE: Combine columns into One with Delimiter

    Sean Lange (6/6/2013)


    Here is another:

    select stuff(isnull(col1 + '/', '') + isnull(col2 + '/', ''), LEN(isnull(col1 + '/', '') + isnull(col2 + '/', '')), 1, '')

    from Table_1

    Sean, you gave me an...

  • RE: Combine columns into One with Delimiter

    Just another option

    select CASE WHEN col1 + col2 IS NULL

    THEN COALESCE( col1, col2, '')

    ELSE col1 + '/' + col2 END as secondtry

    from Table_1

  • RE: Combine columns into One with Delimiter

    It's not an elegant solution but it works

    select isnull(col1,'') + ISNULL( RIGHT( col1 + col2 + '/', 1), '') +rtrim(isnull(col2,'')) as firsttry from Table_1

  • RE: Inline Table Valued Function

    No need for a loop, what you need is a Tally (numbers) table.

    The "Numbers" or "Tally" Table: What it is and how it replaces a loop.[/url]

  • RE: Brain lock...

    I was going to suggest the CROSS APPLY UNPIVOT[/url] but I realized it was the 2005 forum.

    There's not a great solution with denormalized data like this one. A UNION ALL...

  • RE: SQL Query

    This is not the optimal solution, you would be better using dates. For a better performing query, please post DDL and sample data as indicated on the article linked in...

Viewing 15 posts - 8,071 through 8,085 (of 8,731 total)