Forum Replies Created

Viewing 15 posts - 256 through 270 (of 1,217 total)

  • RE: Grouping/Aggregating records

    This should work for the first output table, if DateSent is unique for each ThreadID. If it isn't, it will return several rows for such ThreadID:

    SELECT m.EmailID, m.ClientID, m.DateSent, m.Subject,...

  • RE: RBAR to Set Based Solution; for the honour and the glory.

    Let's see if I understood it correctly. You have a series of rows, where each row has a certain StartDate. Inside each series, you want to generate EndDate for each...

  • RE: Grouping/Aggregating records

    bledu (10/1/2007)

    but as for the sql, the plain old select should do the trick as suggested by Steve above.

    As I understand it, ThreadID is a FK in this table, and...

  • RE: Grouping/Aggregating records

    Is the DateSent alone enough to get always maximum 1 row for a ThreadID, or can there be any ties (several rows with the same threadID and DateSent)? If there...

  • RE: Manual data entry in tables..Any shortcut

    noeld (9/26/2007)

    All against EM use for Data Entry raise your hand .... 😀

    I'm unsubscribing from this topic. If everybody who is against using EM for data entry posts here, my...

  • RE: String Manipulation

    Also, you should ALWAYS use length parameter when converting to some string datatype (CHAR, VARCHAR...) or defining columns or variables with it.

    If you skip the parameter while converting, not...

  • RE: Embedding Excel in a Send Mail Task

    Same here... in most cases we embed or attach HTML file, in some special cases we attach Excel file. But I have never tried to embed Excel into a mail.

  • RE: Needs help on backups.

    If you don't know what tables were affected by the changes, you can't do anything without some tool that's designed for it.

    Maybe you don't have any at the moment, but...

  • RE: Conversion failed when converting datetime from character string.

    Sergiy (9/26/2007)


    You need to explicitly convert DATETIME variables to VARCHAR before you use it in concatenation for PRINT or anything else.

    Otherwise Server is trying to convert all VARCHAR variables to...

  • RE: Conversion failed when converting datetime from character string.

    Please post the definition at least of table Waitlist and table WLLOG (CREATE TABLE statements)... even better, of all tables used in this SQL. Maybe we will be able to...

  • RE: Aggregate function

    David,

    your solurion does not take into account the requirement "lower than average of their department".

    SELECT e.empname

    FROM edtl e

    GROUP BY e.empname, e.sal

    HAVING e.sal < (SELECT AVG(sal) FROM edtl WHERE depid...

  • RE: Aggregate function

    Probably the best way would be to calculate average salary for each department, and then compare it with the salary of a given employee. Use of a derived table would...

  • RE: T-SQL Extract Solution for Legacy Custom Fields

    So that basically means that you can have any datatype in this column [value]. Oh my god... What a genius it must have been to produce something like that.

    What...

  • RE: To put a string in a variable & use it in a WHERE?

    Well, it will be the scope now :-). In example 1, you use:

    set @sql='update #OrderDetails set quantity=0 where '+@WhereCriteria

    exec @sql

    That means, value of @wherecriteria is resolved while the @sql variable...

  • RE: Bug in stored procedure

    This looks strange:

    1=CASE

    WHEN (@LAST_NAME IS NULL OR @LAST_NAME = '') THEN 1

    WHEN (@LAST_NAME IS NOT NULL OR @LAST_NAME '') THEN 1

    ELSE 0

    END

    That basically means "never mind, whatever @last_name is,...

Viewing 15 posts - 256 through 270 (of 1,217 total)