Forum Replies Created

Viewing 15 posts - 121 through 135 (of 1,347 total)

  • RE: Join Statements

    If @Parm1 is NULL when not supplied, then the following will accomplish your query in 1 statement:

    LEFT OUTER JOIN TRADE_ALLOCATION TA

     

  • RE: Getting the Latest Distinct Records

    Joining to a derived table that generates the MAX() is a common way to solve this, just beware of ties.

    If you have 2 records with different Zip values, but same...

  • RE: Getting the Latest Distinct Records

    SELECT MMS, MAX(TrackingDate) As CheckTrackingDate

    FROM DailyAccountsDownload_Tracking

    GROUP BY MMS

    Grouping by a column accomplishes the Distinct requirement.

  • RE: Error returned when executing sp_helpdb

    Check the owner of the DB you're running this in.

    Chances are, the DB owner's Windows account has been deleted. Use sp_changedbowner to reset the owner to a valid Windows account.

  • RE: Query Optimization

    FROM     drs_pending_deduct AS a

             LEFT OUTER JOIN settlement AS b

               ON a.order_id = b.order_id

    WHERE    a.company_id = 'TMS2'

             AND a.payee_id IN (SELECT id

                                FROM   payee

                                WHERE  status = 'A'

                                       AND non_office_emp = 'Y'

                                       AND company_id = 'TMS2')

             AND a.ready_to_pay_flag <> 'V'

             AND a.amount IS NOT NULL

     

    For optimization, try removing the IN (SELECT ...).

    Make it an...

  • RE: Query Optimization

    >>Alright guys, this is going to be a bit messy.

    That qualifies as understatement of the month

    Try these SQL formatting sites:

    http://www.sqlinform.com/

    http://www.wangz.net/cgi-bin/pp/gsqlparser/sqlpp/sqlformat.tpl

     

     

     

  • RE: split data using two conditionals into 2 results columns

    You use CASE ... WHEN for conditionals in SQL Server. Use CASE WHEN to translate the download type into a 1 or zero result, then SUM() the 1's and zeroes...

  • RE: Could not complete cursor operation because the table schema changed after the cursor was declared.

    Auto-shrink can cause this error, if the auto-shrink kicks in and re-arranges data pages while the cursor is open. Same with maintenance plans that do re-indexing.

    Check neither of these are...

  • RE: Tuning update statement

    Without knowing data volumes and data distribution of the values in the indexed columns, I would try variations that remove the IN (SELECT ...)

    Update A

    Set flag = NULL, core =...

  • RE: Discussion Forum - table design suggestions

    I'd see a Thread as being a container for 1 or more Message records. The Thread entity would not contain a message. Some properties might be:

    ThreadID (PKey)

    Subject

    IsSticky

    IsLocked

    IconID

    CreatedBy

    LastReplyDate

    NumberOfReplies

    Every Message would have...

  • RE: Discussion Forum - table design suggestions

    Not saying your design is flawed, but I would model it based on the type of objects found in a forum.

    Table for Forum.

    Table for Threads.

    Table for Messages.

    The only distinction between...

  • RE: where date1 > ? AND date2 <= GETDATE() does not work in yukon

    The '?' is a parameter placeholder. In Sql2K DTS, it would typically be replaced at runtime by a DTSGlobalVariable, presumably so that the DTS package could be dynamically run for...

  • RE: Timeout problem

    The Timeout property is on a SqlCommand object.

    You are constructing a SqlDataAdapter with a hard-coded SQL string, which (I think) will result in the SqlDataAdapter's SelectCommand property being set.

    Therefore, to...

  • RE: Complicated Count???

    There are 2 problems here, getting distinct views per player , then pivoting those results into 11 distinct "buckets". There are ways to dynamically pivot, but since you have a...

  • RE: help with stored procedure error message

    Neither table contains a column named "Level1".

    Neither table contains a column named "Lvl2".

    There error is telling you exactly what's wrong. You are using column names that don't exist.

     

     

Viewing 15 posts - 121 through 135 (of 1,347 total)