Viewing 15 posts - 3,601 through 3,615 (of 4,087 total)
It's doing integer division. 100/200 = 0.
The simplest way to not use integer division is to multiply by a decimal or float value (such as 1.00) first.
1.00 * 100/200...
September 26, 2011 at 1:44 pm
You don't need the quotes. (In fact, I think the quotes cause problems.)
Drew
September 26, 2011 at 1:29 pm
Here is a sample of the batch file. You have to specify the server and database separately, so the IF statement is setting up different environment variables for each.
if...
September 26, 2011 at 1:08 pm
This will also give you the correct results. I suspect it might be more efficient than having the two separate subqueries, but haven't had a chance to test it.
SELECT...
September 26, 2011 at 12:48 pm
mw112009 (9/26/2011)
We have 6 servers and I have to deploy many stored procs in each of these servers. Doing them manually is a pain. Besides I run into situations where...
September 26, 2011 at 12:37 pm
Your English statement of the criteria does not match the expected results. Transaction_IDs 1-8 all have an instance of Type A, so they should all be included in your...
September 26, 2011 at 11:56 am
As I suggested earlier, you probably want to use a CTE with Row_Number()
WITH POLineItems AS (
SELECT A.OrdN03
...
September 23, 2011 at 9:43 am
You just need to use slightly different syntax.
SELECT p.escProduct AS ep, count(*) as totEsc,
CASE WHEN o.ocDateClosed IS NULL THEN
avg(DATEDIFF(DAY, o.ocDateOpened, GETDATE()))
ELSE avg(DATEDIFF(DAY, o.ocDateOpened, o.ocDateClosed))
End AS 'srAge'
FROM tblocMain o INNER JOIN...
September 23, 2011 at 8:07 am
What you're asking to do violates basic principles of database design. Why do you need to do this?
Drew
September 23, 2011 at 7:59 am
HowardW (9/22/2011)I also fundamentally disagree that the purpose of documentation isn't to be accurate.
No one said that it wasn't the goal. What I was trying to say is that...
September 22, 2011 at 2:34 pm
This should give you what you need. It's not tested.
SELECT OrgID, Count(IndID)
FROM Individuals AS i
CROSS APPLY(
SELECT TOP (1) OrgID
FROM Transactions AS t
WHERE t.IndID = i.IndID
ORDER BY TranID
) AS t
GROUP...
September 22, 2011 at 2:02 pm
You don't need to supply a real datetime for the 99999999. Min() and Max() will only return NULL if all of the values are NULL, but that's what you...
September 22, 2011 at 1:40 pm
With appropriate indices, a CROSS/OUTER APPLY should perform better, but you should test it with your actual data. An OUTER APPLY corresponds to the LEFT JOIN that you are...
September 22, 2011 at 12:52 pm
HowardW (9/21/2011)
Maybe I'm misreading, or is this a mistake in BOL? (you'd think not for the amount this article is used)
Manuals are not technical specs nor are they gospel. ...
September 22, 2011 at 10:46 am
duanecwilson (9/21/2011)
I had been working on a larger query that surrounded this one
In that case, you might consider using a CROSS APPLY instead of Max().
SELECT DayKey, Port_ID
FROM <<Main Query>>
CROSS APPLY...
September 22, 2011 at 9:53 am
Viewing 15 posts - 3,601 through 3,615 (of 4,087 total)