Viewing 15 posts - 196 through 210 (of 256 total)
Thanks for the response. Here is my proc: The case statement is in order by clause. How can I make it more efficient:
CREATE PROCEDURE [dbo].[sp_getClients]
AS
BEGIN
SELECT intID, ClientID
FROM ...
March 13, 2009 at 9:40 am
ok here is my updated code:
CASE ClientID WHEN CHARINDEX('-',ClientID) <> 0 THEN
(CASE WHEN ISNUMERIC(SUBSTRING(ClientID ,CHARINDEX('-',ClientID ) + 1, 5)) = 1
THEN CONVERT(INT,SUBSTRING(ClientID ,CHARINDEX('-',ClientID ) + 1, 5))
ELSE ClientID...
March 13, 2009 at 7:15 am
Simon,
I have done all of that, but is there a way to debug right into the SP from ssms?
Thanks.
March 13, 2009 at 6:36 am
Matt's explanation makes sense now, should have read his previous posting properly. Grant mentioned about generated code, but this code is certainly not generated through any code...
January 9, 2009 at 11:46 am
Hi Matt,
But how long does it take to type the word "WHERE" ? Im I missing something? The queries are as simple as:
SELECT * FROM tblA WHERE...
January 9, 2009 at 10:18 am
Hi David,
I previsouly added the case statement in the group by, but forgot to add it in the order by and that's where the problem was....
December 26, 2008 at 8:25 am
Here is the correct query:
SELECT
SalesMan1,
SUM(grand_inv_total) as TotalSales,
DATEPART(mm,CONVERT(DATETIME,DateEntered,106)) as Month
FROM Sales WITH (NOLOCK)
WHERE SUBSTRING(DateEntered,1,4) = 2008
AND SalesMan1 <> ''
GROUP BY SalesMan1, DATEPART(mm,CONVERT(DATETIME,DateEntered,106))
ORDER BY SalesMan1, DATEPART(mm,CONVERT(DATETIME,DateEntered,106))
Here the...
December 26, 2008 at 8:01 am
Thanks Gail. That makes perfect sense and it is taking less longer than the other one. Thanks again.
December 22, 2008 at 3:15 pm
Thanks Gail,
I still have a cursor, but now I am updating based on the value from the cursor. Take a look at this tell me whether...
December 22, 2008 at 2:58 pm
Hello All,
I just could not see the extra "D" in the "UPDATE". Thanks for pointing that out. As far as "set based insert", I am little...
December 22, 2008 at 2:47 pm
Hi Gail,
Here is a whole stored procedure. I don't think that giving you any additional structure will help:
ALTER Procedure [dbo].[SP_Proc1]
(
@RDCCHAR(5) = '00910',
@DateOneDATETIME = '03/04/2007',
@DateTwoDATETIME = '04/02/2007',
@LocationNo...
November 24, 2008 at 2:46 pm
Hi Gail,
I am not sure that I am understanding what you mean by
"moving the subquery with the sum into the from clause and treating it...
November 21, 2008 at 3:48 pm
Hi Gail,
I apologize. Here is the actual query:
UPDATE #TMP
SET
...
November 21, 2008 at 12:30 pm
Hi Gail,
Here is the whole query:
UPDATE #TMP
SET
ItmRecvdYR2=ISNULL((SELECT SUM(Quantity) FROM dbo.GetAllReorderScannedItemsByDate() INNER JOIN (SELECT VendorID, LOC, DateYR2 FROM #TMP) TMPData ON VendorID=TMPData.VendorID AND locationno=TMPData.LOC and DATEPART(YEAR,requisitiondate) =...
November 21, 2008 at 11:23 am
Viewing 15 posts - 196 through 210 (of 256 total)