Forum Replies Created

Viewing 15 posts - 931 through 945 (of 1,217 total)

  • RE: Assign Top 1 to variable

    Or, if you prefer to use SET for setting of one variable:

    Declare @Name varchar(30)

    SET @Name = (SELECT TOP 1 CustName

        From Customer

        Order By CustName)

  • RE: Select nth highest marks

    Well, that's something you have to know (or find out) - I don't know who will use the result and for what it will be used. But... let's analyze it. If you...

  • RE: if / else statement?

    A new column has pros and cons... If later more people have to be reported sometimes here and sometimes there, like James now, it will be easier to implement it....

  • RE: if / else statement?

    No, the first query in my post is (or should be, if I didn't make any mistake) the same query you are using now - taken from your post, just...

  • RE: Advise needed

    A bit risky IMHO... what if the mail fails one day and sends nothing? The user won't get this info any more unless you run a special query. We monitor several things...

  • RE: if / else statement?

    I am not sure, since my orientation in the old syntax is not good, but translated into JOINs it should be something like this:

    select AOofficeName as Office, count(ARid) as totReferrals

    from...

  • RE: Question of the Day for 20 Oct 2005

    The most interesting thing is, why the result column is labelled "day of week"... probably to confuse enemy agents

  • RE: Select nth highest marks

    Sreenath,

    your first post is a bit inconsistent. You want to select the 2nd highest value, but for D3 there is only 1 value. That means, D3 should not appear in...

  • RE: Select nth highest marks

    As it seems to me, as long as they only require the marks, without any other specification of the case, it makes no difference if there is a tie precisely at the Nth...

  • RE: How to convert varchar into datetime

    As far as I can remember, you get this error message if one of the strings to be converted:

    1) does not result in a date at all (incorrect entry)

    2) does...

  • RE: Automatically Create Joints

    Well, you should check carefully how the states are stored in the concatenated column. Are the state abbreviations always 2 letters? If you have branches in Canada and have it stored as...

  • RE: How to add column in specific position

    Well, generally I agree, and I never write SELECT * in any SQL that is used repeatedly. But from a practical viewpoint, it is fine that the structure of a table...

  • RE: ISNUMERIC equivalent

    Take care with ISNUMERIC... it isn't what it seems :-). If what you want is to check whether all chracters in a string are numbers, then this is not 100%...

  • RE: Auto-roll date

    phillcart,

    your solution is set-based, but it has one serious flaw... it doesn't work as expected (or at least not as I understood the question). You check holidays table first, and...

  • RE: Auto-roll date

    And what about this? Using standard format for datetime (YYYYMMDD); taking into account how the question was formulated("datepart between 2 and 6"), I decided to use a SET DATEFIRST 7 setting.

    create table...

Viewing 15 posts - 931 through 945 (of 1,217 total)