Forum Replies Created

Viewing 15 posts - 946 through 960 (of 1,494 total)

  • RE: Simple date question

    For the two date formats given the following will work:

    -- set to european format.

    SET DATEFORMAT dmy

    DECLARE @t TABLE

    (

    CharDate char(10) NOT NULL

    )

    INSERT INTO @t

    SELECT '31/12/2009' UNION ALL

    SELECT '2009-06-30'

    SELECT ISDATE(REPLACE(Chardate, '-', ''))...

  • RE: maximum number of parameters in sp_executesql

    With SQL2008 and the latest version of ADO you can even pass a table.

  • RE: required help

    Without test data, and expected results, it is difficult to tell but maybe something like:

    SET QUOTED_IDENTIFIER, ANSI_NULLS ON

    GO

    CREATE PROCEDURE dbo.P_SRE_T_CAL

    @CURDATE datetime,

    @ERROR varchar(50) OUTPUT,

    @TRANIDUP varchar(8000)...

  • RE: Sub proc not returning error code when using TRY...CATCH block

    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

  • RE: BETWEEN returns no column

    Try the universal data format:

    SELECT count(*)

    ,[date]

    FROM tbl1

    WHERE [date] BETWEEN '20090501' AND '20090531 23:59:59.997'

    GROUP BY [date]

  • RE: Substring statement

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

  • RE: Outer join and inner join

    Logically the INNER JOIN is done first. ie The INNER JOIN is the nested join.

  • RE: Filtering by date

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

  • RE: Outer join and inner join

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

  • RE: Limiting query execution time through the join

    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.

  • RE: Assure the release of an application lock

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

  • RE: Help me in this store procedure...

    WHERE Title LIKE SearchText + '%'

    AND [Description] LIKE SearchText+ '%'

    AND link LIKE SearchText + '%'

  • RE: Locking a stored procedure for updating/reading

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

  • RE: Locking a stored procedure for updating/reading

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

  • RE: Select integer ranges

    Nice idea Mark.

    This may be a slightly simpler way to catch the gap in RangeId

    ;WITH CTE AS (

    SELECT RangeId,

    CountryCode,

    ...

Viewing 15 posts - 946 through 960 (of 1,494 total)