Viewing 15 posts - 3,766 through 3,780 (of 4,087 total)
SELECT Convert(varchar(25), Max(dt), 100)
FROM #Temp
WHERE DateDiff(Month, dt, Getdate()) BETWEEN 1 AND 2
GROUP BY DateDiff(Month, dt, Getdate())
ORDER BY Max(dt)
I personally would return the dates in datetime format, rather than converting them...
March 11, 2011 at 10:28 am
Because they appear in the SELECT clause instead of the FROM clause the aliases a, b, and c are column aliases, but you are trying to treat a and b...
March 8, 2011 at 2:44 pm
pamozer (3/3/2011)
I'm assuming the OP is me but what does it stand for? And I hadn't checked the actual data yet only the counts.
OP is Original Poster.
March 3, 2011 at 3:08 pm
opc.three (3/3/2011)
drew.allen (3/3/2011)
opc.three (3/3/2011)
SELECT b.value('(offerId)[1]', 'Int') AS [offer_id],
fr.value('(internetPrice)[1]', 'decimal') AS [internet_price],
fr.value('(newStandPrice)[1]', 'decimal')...
March 3, 2011 at 2:53 pm
opc.three (3/3/2011)
SELECT b.value('(offerId)[1]', 'Int') AS [offer_id],
fr.value('(internetPrice)[1]', 'decimal') AS [internet_price],
fr.value('(newStandPrice)[1]', 'decimal') AS [news_stand_price],
...
March 3, 2011 at 2:35 pm
You're shredding the same document twice when you really don't need to, because you started from the highest relevant point in the document hierarchy and worked down, when you really...
March 3, 2011 at 1:47 pm
Jeff Moden (3/2/2011)
drew.allen (3/2/2011)
SELECT *
FROM TableA
INNER JOIN TableB
ON TableA.ID LIKE Cast(TableB.ID as varchar(11)) + '%'
This...
March 2, 2011 at 3:17 pm
Another option is to use the LIKE operator. I don't know which will perform better.
SELECT *
FROM TableA
INNER JOIN TableB
ON TableA.ID LIKE Cast(TableB.ID as varchar(11)) + '%'
This assumes that the...
March 2, 2011 at 8:44 am
Do you really want to return fiscal year plus calendar month rather than fiscal year plus fiscal period?
I also dislike using a CASE statement to return the fiscal year, because...
February 23, 2011 at 2:58 pm
yoho23_2000 (2/22/2011)
Is there anything obvious you can see
Yes, you're using a CURSOR when you should be using a set-based approach. I can't tell you the exact set-based approach to...
February 23, 2011 at 2:07 pm
What I've done in these cases is use a TRY/CATCH block leaving the CATCH block empty.
BEGIN TRY
EXEC msdb.dbo.sp_send_dbmail <your parameters here>
END TRY
BEGIN...
February 10, 2011 at 7:34 am
The problem with your original CASE statement is that you were trying to return a Boolean value and T-SQL won't let you return a Boolean value. You can restructure...
February 7, 2011 at 3:19 pm
You can also rewrite this using a single CASE statement, which is usually more succinct and therefore easier to follow.
Select
case when SO.CUSTOMER = R.CUSTOMER AND R.QUANTITY_REMAINING >= R.CUSTOMER_QTY_NOT_SHIPPED
then...
February 3, 2011 at 3:16 pm
Jeff Moden (2/1/2011)
drew.allen (1/31/2011)
Craig Farrell (1/31/2011)
After having done some other tests, this method seems to be the quickest, especially if you have a solid index on Item/ChangePriceDate
My tests indicate the...
February 1, 2011 at 10:08 am
Craig Farrell (1/31/2011)
After having done some other tests, this method seems to be the quickest, especially if you have a solid index on Item/ChangePriceDate
My tests indicate the opposite. I've...
January 31, 2011 at 1:42 pm
Viewing 15 posts - 3,766 through 3,780 (of 4,087 total)