Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Database & SysAdmin
  3. Database
  4. need help resolving error in custom sp

need help resolving error in custom sp

Scheduled Pinned Locked Moved Database
helpsharepointdatabase
3 Posts 3 Posters 1 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • B Offline
    B Offline
    brainfuelmedia_
    wrote on last edited by
    #1

    Hello, I've created the following stored procedure: CREATE PROCEDURE SOM_RO_ISVALIDPRJID @strProjectID varchar(32) AS BEGIN DECLARE @intPrjID int SET NOCOUNT ON; @intPrjID = (SELECT COUNT(*) FROM dbo.tbl_projects_main WHERE prj_custom_id = @strProjectID) END IF (@intPrjID = 0) RETURN 0 ELSE RETURN 1 GO I keep getting the error: Incorrect syntax near '@intPrjID' at line 8. The line it is referring to is where I have @intPrjID = (SELECT ...) Ryan

    W K 2 Replies Last reply
    0
    • B brainfuelmedia_

      Hello, I've created the following stored procedure: CREATE PROCEDURE SOM_RO_ISVALIDPRJID @strProjectID varchar(32) AS BEGIN DECLARE @intPrjID int SET NOCOUNT ON; @intPrjID = (SELECT COUNT(*) FROM dbo.tbl_projects_main WHERE prj_custom_id = @strProjectID) END IF (@intPrjID = 0) RETURN 0 ELSE RETURN 1 GO I keep getting the error: Incorrect syntax near '@intPrjID' at line 8. The line it is referring to is where I have @intPrjID = (SELECT ...) Ryan

      W Offline
      W Offline
      WoutL
      wrote on last edited by
      #2

      replace it with: SELECT @intPrjID = COUNT(*) FROM dbo.tbl_projects_main WHERE prj_custom_id = @strProjectID or with Set @intPrjID = (SELECT COUNT(*) FROM dbo.tbl_projects_main WHERE prj_custom_id = @strProjectID)

      Wout Louwers

      1 Reply Last reply
      0
      • B brainfuelmedia_

        Hello, I've created the following stored procedure: CREATE PROCEDURE SOM_RO_ISVALIDPRJID @strProjectID varchar(32) AS BEGIN DECLARE @intPrjID int SET NOCOUNT ON; @intPrjID = (SELECT COUNT(*) FROM dbo.tbl_projects_main WHERE prj_custom_id = @strProjectID) END IF (@intPrjID = 0) RETURN 0 ELSE RETURN 1 GO I keep getting the error: Incorrect syntax near '@intPrjID' at line 8. The line it is referring to is where I have @intPrjID = (SELECT ...) Ryan

        K Offline
        K Offline
        Krish KP
        wrote on last edited by
        #3

        along with the two methods specified by Wout Louwers also this can be used SELECT @intPrjID = (SELECT COUNT(*) FROM dbo.tbl_projects_main WHERE prj_custom_id = @strProjectID) (i.e. instead of SET, SELECT can be used.)

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups