Forum Replies Created

Viewing 15 posts - 2,356 through 2,370 (of 3,957 total)

  • RE: Distributing the greatest value by rank in SQL

    lmeinke,

    I see where you added the sales_rank column but I don't see how that adversely affects the results. So let's modify the final select slightly.

    CREATE TABLE #SalesByEmployeeCategory

    (Category VARCHAR(100)

    ...

  • RE: Distributing the greatest value by rank in SQL

    The thing about the Quirky Update is that it's, well... quirky.

    Sometimes you'll need to play with it a might to get the results you expect.

    I'll look at this again but...

  • RE: Get continuous date with count

    :hehe: It will tend to do that the way I fudged the grouping factor.

    Just goes to show that thorough test data is the best way to a good solution.

    What about...

  • RE: Are the posted questions getting worse?

    As the holiday season rapidly approaches, I'd like to take a minute to wish everyone on this forum a Merry Christmas and very happy New Year.

    The first anniversary of my...

  • RE: Hi frn

    I can try. 😉

    The ORDER BY is split into two levels:

    1. First the characters, which get assigned the empty string when the value is a numeric (which will sort before...

  • RE: Hi frn

    Not very elegant but you might be able to use something like this, assuming your intent is to sort numbers first as numbers followed by non-numeric characters:

    CREATE TABLE #varchar_field1 (...

  • RE: datetime2 and Excel

    Chris-475469 (12/17/2012)


    Yeah you're right!

    I thought datetime2 was supposed to consume less bytes than datetime depending on the precision used?

    I'll check MSDN again.

    Actually I didn't check the byte-size difference - that...

  • RE: datetime2 and Excel

    Chris-475469 (12/17/2012)


    It's more an issue of we asked the developers to use datetime2 going forward. The precision isn't really an issue.

    It looks like we'll be having another discussion on datetime...

  • RE: datetime2 and Excel

    Chris-475469 (12/17/2012)


    Its annoying because it means we'd have to cast or convert every datetime2 date that could appear on the spreadsheet(s).

    The developers will argue it'd be quicker to change the...

  • RE: datetime2 and Excel

    Personally I've never tried it but a quick test of this:

    SELECT CAST('2012-01-01' AS DATETIME2)

    If you copy/paste the result into Excel it can be formatted as a date with nor problem.

    As...

  • RE: Select all data where one condition is met

    DataAnalyst011 (12/17/2012)


    Again this is really helpful. I hope you all won't mind a follow-up question:

    What is the difference between...

    WHERE [column] IN ([subquery])

    and

    WHERE EXISTS ([subquery])

    ?

    I've been trying to read on...

  • RE: Retrieve second of three values separated by spaces

    Another way:

    DECLARE @spitme TABLE (Item varchar(40));

    INSERT @spitme VALUES ('HEYE-B Euro-IPA 69793'), ('HEYE-B RFE-IPA 70940');

    SELECT STUFF(STUFF(Item, 1, CHARINDEX(' ', Item), ''), CHARINDEX(' ', STUFF(Item, 1, CHARINDEX(' ', Item), '')), LEN(Item), '')

    FROM...

  • RE: ''=0 ?!?!

    If you think those "typos" that pass SQL Server's parser seem weird, try this one:

    SELECT 7+$

  • RE: how to get calculate data based on other column in same table

    Obviously this is some sort of diabolically silly test of your knowledge of windowing functions:

    create table #TestTask1 (Name varchar(1), Territory Varchar(1), sales_amount int);

    insert into #TestTask1 values ('A','X',100)

    insert into #TestTask1 values...

  • RE: Distributing the greatest value by rank in SQL

    lmeinke (12/17/2012)


    dwain.c (12/14/2012)


    lmeinke (12/14/2012)


    Steve,

    I was actually replying to dwain c. but I do thank you as well. I was out of the office for a few days and didn't...

Viewing 15 posts - 2,356 through 2,370 (of 3,957 total)