sp problem?

  • what is the problem?

    USE [ADMS]

    GO

    /****** Object: StoredProcedure [dbo].[procCityWiseListofPledgeSelect] Script Date: 03/18/2011 10:15:54 ******/

    SET ANSI_NULLS ON

    GO

    SET QUOTED_IDENTIFIER ON

    GO

    ALTER PROCEDURE [dbo].[procCityWiseListofPledgeSelect]

    @EVENTCODEID INT,

    @FROMBROADCASTID INT,

    @TOBROADCASTID INT,

    @FROMREPEATID INT,

    @TOREPEATID INT,

    @CONTACTMODEID INT,

    @FROMEVENTDATE DATE,

    @TOEVENTDATE DATE,

    @ISKEYCITY BIT,

    @FROMAMOUNT MONEY,

    @TOAMOUNT MONEY,

    @FromSymbol nvarchar(10),

    @ToSymbol nvarchar(10)

    /*******************************************************************

    * PROCEDURE: [[PROCCITYWISELISTOFPLEDGESELECT]]

    * PURPOSE: SEARCH THE PARTNERS FOR THE GIVEN DETAILS

    * NOTES: {SPECIAL SET UP OR REQUIREMENTS, ETC.}

    * CREATED: PANNEER SELVAM

    * MODIFIED

    * DATE: 15-MAR-2011 AUTHOR DESCRIPTION

    *-------------------------------------------------------------------

    * {DATE} {DEVELOPER} {BRIEF MODIFICATION DESCRIPTION}

    *******************************************************************/

    AS

    BEGIN

    SET NOCOUNT ON;

    SET @FROMBROADCASTID = NULLIF(@FROMBROADCASTID,0)

    SET @TOBROADCASTID = NULLIF(@TOBROADCASTID,0)

    SET @FROMREPEATID = NULLIF(@FROMREPEATID,0)

    SET @TOREPEATID = NULLIF(@TOREPEATID,0)

    SET @FROMEVENTDATE = NULLIF(@FROMEVENTDATE,'1753-01-01 00:00:00.000')

    SET @TOEVENTDATE = NULLIF(@TOEVENTDATE,'1753-01-01 00:00:00.000')

    IF @TOBROADCASTID IS NULL OR @TOBROADCASTID = 0

    SET @TOBROADCASTID=@FROMBROADCASTID

    IF @TOREPEATID IS NULL OR @TOREPEATID = 0

    SET @TOREPEATID=@FROMREPEATID

    IF @TOEVENTDATE IS NULL OR @TOEVENTDATE = '1753-01-01 00:00:00.000'

    SET @TOEVENTDATE=@FROMEVENTDATE

    --IF @TOAMOUNT IS NULL OR @TOAMOUNT = ''

    --SET @TOAMOUNT = @FROMAMOUNT

    IF @ISKEYCITY = 0 OR @ISKEYCITY IS NULL OR @ISKEYCITY ='FALSE'

    SET @ISKEYCITY = 0

    ELSE

    SET @ISKEYCITY = 1

    SELECT C.CITYNAME AS CITY

    ,PLEDGE_ID

    ,TOTALPLEDGEDAMOUNT

    ,TOTALPLEDGEDAMOUNTUSD

    ,B.BROADCASTNAME

    ,R.REPEATNAME

    ,P.PLEDGEDDATE AS EVENTDATE

    ,P.EVENTCODE_ID

    ,C.ISKEYCITY

    ,B.BROADCAST_ID

    ,R.REPEAT_ID

    ,S.STATENAME

    ,CN.COUNTRYNAME

    ,(CASE WHEN P.NOOFMONTHS > 1 THEN 'MONTHLY' ELSE 'ONETIME' END) AS SCHEME

    FROM EVENTSCHEDULE AS ES

    RIGHT JOIN EVENTBATCH AS EB ON ES.EVENTSCHEDULE_ID = EB.EVENTSCHEDULE_ID

    LEFT JOIN PLEDGE AS P ON EB.EVENTBATCH_ID = P.EVENTBATCH_ID

    LEFT JOIN BROADCAST AS B ON ES.BROADCAST_ID = B.BROADCAST_ID

    LEFT JOIN [REPEAT] AS R ON ES.REPEAT_ID=R.REPEAT_ID

    LEFT OUTER JOIN PARTNERS AS PA ON P.PARTNER_ID=PA.PARTNER_ID

    LEFT JOIN CITY AS C ON PA.CITY_ID=C.CITY_ID

    LEFT JOIN [STATE] AS S ON PA.STATE_ID=S.STATE_ID

    LEFT JOIN COUNTRY CN ON PA.COUNTRY_ID=CN.COUNTRY_ID

    WHERE 1=1

    AND ((@EVENTCODEID IS NULL) OR (P.EVENTCODE_ID = @EVENTCODEID))

    AND ((@FROMBROADCASTID IS NULL) OR (B.BROADCAST_ID BETWEEN @FROMBROADCASTID AND @TOBROADCASTID))

    AND ((@FROMREPEATID IS NULL) OR (R.REPEAT_ID BETWEEN @FROMREPEATID AND @TOREPEATID))

    AND ((@FROMEVENTDATE IS NULL) OR (P.PLEDGEDDATE BETWEEN @FROMEVENTDATE AND @TOEVENTDATE))

    --AND ((@FROMAMOUNT IS NULL) OR (P.TOTALPLEDGEDAMOUNT + CHAR(39)+ @fromsymbol+ CHAR(39)+ @FROMAMOUNT ))

    AND (ISKEYCITY=@ISKEYCITY OR ISKEYCITY=1)

    END

  • These are the problems .

    1. No source tables (tables that are addressed in the SP)

    2. No sample data for the tables

    3. No sample input parameters for the SP

    last but not the least,

    4. The error description or the error message that u are getting when u execute it!!

    :w00t::w00t:

  • Hi Pravin

    I am guessing that you are trying to move a stored procedure from one database to another and have scripted out the SQL code. If this is the case then you need to change the ALTER statement to CREATE

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply