Viewing 15 posts - 946 through 960 (of 1,491 total)
Either use exception handling in the calling procedure or try the following:
--Run subproc
DECLARE @err int
EXEC @err = spNewSubProc @params
IF @err 0
GOTO OnError
August 7, 2009 at 10:25 am
Try the universal data format:
SELECT count(*)
,[date]
FROM tbl1
WHERE [date] BETWEEN '20090501' AND '20090531 23:59:59.997'
GROUP BY [date]
August 7, 2009 at 8:41 am
Difficult to tell without sample data and expected results, but you seem not to be restricting the subqueries
by the STVTERM_DESC. In this case I would forget about subqueries and just...
August 6, 2009 at 9:49 am
Logically the INNER JOIN is done first. ie The INNER JOIN is the nested join.
August 5, 2009 at 1:53 am
Maybe something like:
-- *** Test Data ***
DECLARE @t TABLE
(
Item int NOT NULL
,Sales_Date smalldatetime NOT NULL
,Quantity int NOT NULL
,Amount money NOT NULL
)
INSERT INTO @t
SELECT 1, '20090222', 1, 5.00 UNION ALL
SELECT 1,...
August 4, 2009 at 8:11 am
This is a nested join. To make it readable I would recommend that you always use brakets:
SELECT *
FROM dbo.demog dm
RIGHT JOIN
(
dbo.packlist pl
JOIN dbo.kittype kt
ON pl.kittype = kt.kittype
)
ON dm.siteid =...
August 4, 2009 at 6:19 am
You should check this yourself by looking at the query plans.
I suspect the plans will be the same as the optimizer should sort out the best access path.
July 28, 2009 at 3:19 am
You could try putting sp_releaseapplock in the CATCH block as well as the TRY block.
As you seem to be using SESSION applocks I think you would have difficulty is determining...
July 28, 2009 at 3:12 am
WHERE Title LIKE SearchText + '%'
AND [Description] LIKE SearchText+ '%'
AND link LIKE SearchText + '%'
July 28, 2009 at 2:49 am
paul.davidson.uk (7/27/2009)
ah, so running this SP all the time will not actually create rows? only update the identity?
Correct - the rollback stops the row being added.
Rolling back to a savepoint...
July 27, 2009 at 8:12 am
One row, which can only get read and updated one at a time is what I require, which was why I was trying to use the transaction route.
If you look...
July 27, 2009 at 8:03 am
Nice idea Mark.
This may be a slightly simpler way to catch the gap in RangeId
;WITH CTE AS (
SELECT RangeId,
CountryCode,
...
July 23, 2009 at 11:16 am
And how about
select * from shifthistory where vfrom='20090723 00:00:00'
July 22, 2009 at 6:22 am
'20090722 00:00:00' should work with any date format.
July 22, 2009 at 5:24 am
CASE
WHEN COALESCE(date2, 0) < COALESCE(date1, 0)
THEN date2
ELSE COALESCE(date1, date2)
END
July 22, 2009 at 5:02 am
Viewing 15 posts - 946 through 960 (of 1,491 total)