Forum Replies Created

Viewing 15 posts - 1,021 through 1,035 (of 1,124 total)

  • RE: Filtering on data using the MAX function

    Use HAVING Clause....

    SELECT GroupColumn, MAX( AnyColumn )

    FROM AnyTable

    GROUP BY GroupColumn

    HAVING MAX( AnyColumn ) > 10

  • RE: how to do fast Stored procedure

    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...

  • RE: IF or CASE Condition in JOIN Clause

    goodguy (10/23/2007)


    Ramesh, thanks for grasping the idea so fast, I am grateful.

    The idea is a Hall Reservation will be JOINed with "<=" and a Room Reservation with "<" only.

    I adapted...

  • RE: IF or CASE Condition in JOIN Clause

    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...

  • RE: how to do fast Stored procedure

    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...

  • RE: How to loging with IP Address and login details

    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,...

  • RE: How to remove one of the field in a column separated by ,

    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?

  • RE: Maximum stored procedure, function, trigger, or view nesting level exceeded (limit 32).

    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....

  • RE: update query fails, sql server 2000

    Check the disc space...i often used to get these log full messages..

  • RE: Building a table

    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...

  • RE: TSQL query with stored procedure

    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...

  • RE: Convert positive number to a negative

    David Easley (10/19/2007)


    Ramesh (10/16/2007)


    DECLARE @InitialNumber INT

    DECLARE @OutputNumber INT

    SET @InitialNumber = 9

    SET @OutputNumber = ( CASE WHEN @InitialNumber > 0 THEN -@InitialNumber ELSE @InitialNumber END )

    SELECT @InitialNumber AS Initial, @OutputNumber AS...

  • RE: GROUP BY DateTime field

    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...

  • RE: execute SQL server query from Dos command prompt/ batch file.

    I wonder why nobody has mentioned anything about BCP???

  • RE: shrinking database

    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....

Viewing 15 posts - 1,021 through 1,035 (of 1,124 total)