Viewing 15 posts - 1,021 through 1,035 (of 1,124 total)
Use HAVING Clause....
SELECT GroupColumn, MAX( AnyColumn )
FROM AnyTable
GROUP BY GroupColumn
HAVING MAX( AnyColumn ) > 10
--Ramesh
October 23, 2007 at 7:46 am
Thanks god, I've managed to read the entire code....:hehe:
1. 10+ cursors, get rid of it
2. Repeative code such as
Select @Agent_FirstName=AGT_FIRST_NAME, @Agent_LastName=AGT_LAST_NAME ,@AGT_TITLE=AGT_TITLE From AGENT Where AGT_CODE=@AgentCode
Select @Leader_Code=AGT_SUB_CODE From AGENT...
--Ramesh
October 23, 2007 at 7:39 am
goodguy (10/23/2007)
The idea is a Hall Reservation will be JOINed with "<=" and a Room Reservation with "<" only.
I adapted...
--Ramesh
October 23, 2007 at 7:32 am
FROM @MYTABLE D
LEFT OUTER JOIN @TEMPTABLE RT
ON D.THEDATE >= RT.CHECKIN
AND
(
D.THEDATE <= (CASE WHEN RT.BOARDTYPE < 0 THEN RT.CHECKOUT ELSE D.THEDATE END)
OR
D.THEDATE = 0 THEN RT.CHECKOUT ELSE...
--Ramesh
October 23, 2007 at 6:19 am
You mentioned, you have used cursors in your procedure which i guess might be taking too much of the process time [and most of the time it will]...
If you can...
--Ramesh
October 23, 2007 at 5:53 am
You could use either SQL Query Analyzer or Enterprise Manager to connect to an instance of SQL...
In Query Analyzer, you need to enter credentials in the connect dialog.
In Enterprise Manager,...
--Ramesh
October 23, 2007 at 5:43 am
Can u provide us with some sample data and code that you've tried, so that we can have a better understanding of your requirement?
--Ramesh
October 22, 2007 at 5:02 am
32, which is the max. limit for nesting levels, can't be overriden by any means...
But you can restrict the recursive execution using the function @@NESTLEVEL..
IF @@NESTLEVEL < 32
EXEC dbo.usp_myRecursiveSP....
--Ramesh
October 22, 2007 at 3:54 am
Check the disc space...i often used to get these log full messages..
--Ramesh
October 22, 2007 at 3:46 am
Phil,
Check this snippet.....
IF OBJECT_ID( 'tempdb..#TBL_Address' ) IS NOT NULL
DROP TABLE #TBL_Address
CREATE TABLE #TBL_Address
(
[ID] INT NOT NULL PRIMARY KEY CLUSTERED,
INT NOT NULL
)
INSERT #TBL_Address( ID, )
SELECT 1, 10
UNION ALL
SELECT...
--Ramesh
October 21, 2007 at 6:55 am
You can do something like this in your SP definition....
DECLARE @sInputType VARCHAR(1)
DECLARE @sOutputType VARCHAR(1)
SET @sInputType ='u'
SET @sOutputType = ( CASE @sInputType WHEN 'U' THEN 'U' WHEN 'V' THEN 'V' WHEN...
--Ramesh
October 21, 2007 at 6:00 am
David Easley (10/19/2007)
Ramesh (10/16/2007)
DECLARE @OutputNumber INT
SET @InitialNumber = 9
SET @OutputNumber = ( CASE WHEN @InitialNumber > 0 THEN -@InitialNumber ELSE @InitialNumber END )
SELECT @InitialNumber AS Initial, @OutputNumber AS...
--Ramesh
October 21, 2007 at 5:25 am
What exactly is the issue with the statement?...
You can use convert(varchar(20),@StartDate,105 ) instead of CAST(YEAR(@StartDate) AS varchar(20)) + '-' + CAST(MONTH(@StartDate) AS varchar(20)) + '-' + CAST(DAY(@StartDate) AS varchar(20)) saves...
--Ramesh
October 19, 2007 at 3:58 am
I wonder why nobody has mentioned anything about BCP???
--Ramesh
October 18, 2007 at 9:31 am
I guess shrinking wouldn't be the case here.., it may be because of a delete or truncate is got fired just after the shrink....
--Ramesh
October 18, 2007 at 9:29 am
Viewing 15 posts - 1,021 through 1,035 (of 1,124 total)