Problem in stored procedure in the last line plz help

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • madhu7sudan
    New Member
    • Jul 2007
    • 12

    Problem in stored procedure in the last line plz help

    HI here is the stored procedure

    CREATE Procedure dm_deleteBBPost
    (
    @TopicID numeric,
    @ForumID numeric

    )
    As
    declare @netCount as int

    BEGIN
    Select @netCount=count (*) from tblBBPosts where TopicID=@TopicI D

    update tblBBForums set TotalTopics=Tot alTopics-1,TotalPosts=To talPosts-@netCount where ForumID=@ForumI D

    Delete From tblBBPosts Where TopicID = @TopicID
    Delete From tblBBTopics Where TopicID =@TopicID

    end
    declare @pr_ForumsToday as varchar
    declare @topicname as varchar

    SELECT TOP 1 @topicname=Topi cs FROM tblBBTopics ORDER BY LastPostDate DESC
    @pr_ForumsToday = ' <p><A href=''bbviewpo sts.asp?id="'+ TopicID +'>' +left(@topicnam e,50) + ' ...</a>" & "</p>")'
    GO



    i am getting error in the @pr_ForumsToday line
    syntax error i think plz can any body help
  • jhardman
    Recognized Expert Specialist
    • Jan 2007
    • 3405

    #2
    What language is this?

    Comment

    • shweta123
      Recognized Expert Contributor
      • Nov 2006
      • 692

      #3
      Hi,

      Syntax error is in the variable declaration e.g.

      declare @netCount as int
      It should be : declare @netCount int

      declare @pr_ForumsToday as varchar
      It should be : declare @pr_ForumsToday varchar

      declare @topicname as varchar
      It should be : declare @topicname varchar






      Originally posted by madhu7sudan
      HI here is the stored procedure

      CREATE Procedure dm_deleteBBPost
      (
      @TopicID numeric,
      @ForumID numeric

      )
      As
      declare @netCount as int

      BEGIN
      Select @netCount=count (*) from tblBBPosts where TopicID=@TopicI D

      update tblBBForums set TotalTopics=Tot alTopics-1,TotalPosts=To talPosts-@netCount where ForumID=@ForumI D

      Delete From tblBBPosts Where TopicID = @TopicID
      Delete From tblBBTopics Where TopicID =@TopicID

      end
      declare @pr_ForumsToday as varchar
      declare @topicname as varchar

      SELECT TOP 1 @topicname=Topi cs FROM tblBBTopics ORDER BY LastPostDate DESC
      @pr_ForumsToday = ' <p><A href=''bbviewpo sts.asp?id="'+ TopicID +'>' +left(@topicnam e,50) + ' ...</a>" & "</p>")'
      GO



      i am getting error in the @pr_ForumsToday line
      syntax error i think plz can any body help

      Comment

      Working...