Viewing 15 posts - 121 through 135 (of 1,347 total)
If @Parm1 is NULL when not supplied, then the following will accomplish your query in 1 statement:
LEFT OUTER JOIN TRADE_ALLOCATION TA
March 12, 2007 at 2:46 pm
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...
March 12, 2007 at 12:38 pm
SELECT MMS, MAX(TrackingDate) As CheckTrackingDate
FROM DailyAccountsDownload_Tracking
GROUP BY MMS
Grouping by a column accomplishes the Distinct requirement.
March 12, 2007 at 12:00 pm
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.
March 12, 2007 at 11:45 am
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...
March 12, 2007 at 10:28 am
>>Alright guys, this is going to be a bit messy.
That qualifies as understatement of the month
Try these SQL formatting sites:
http://www.wangz.net/cgi-bin/pp/gsqlparser/sqlpp/sqlformat.tpl
March 12, 2007 at 10:16 am
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...
March 12, 2007 at 8:57 am
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...
March 9, 2007 at 5:17 pm
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 =...
March 9, 2007 at 12:55 pm
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...
March 9, 2007 at 12:11 pm
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...
March 9, 2007 at 11:06 am
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...
March 9, 2007 at 8:43 am
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...
March 8, 2007 at 12:12 pm
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...
March 7, 2007 at 1:18 pm
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.
March 6, 2007 at 10:20 pm
Viewing 15 posts - 121 through 135 (of 1,347 total)