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. How to select first n characters using stored procedure

How to select first n characters using stored procedure

Scheduled Pinned Locked Moved Database
5 Posts 4 Posters 0 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.
  • M Offline
    M Offline
    Meax
    wrote on last edited by
    #1

    this works ok in sql server SELECT MessageID, LEFT(Message, 80) AS Expr1 FROM MSGTble but when i try to do it through stored procedure, my webform is giving me error ALTER PROCEDURE dbo.GetAllMessage AS SELECT MessageID, LEFT(Message, 80) AS Expr1 FROM MSGTble RETURN saying "A field or property with the name 'Message' was not found on the selected data source."

    M A 2 Replies Last reply
    0
    • M Meax

      this works ok in sql server SELECT MessageID, LEFT(Message, 80) AS Expr1 FROM MSGTble but when i try to do it through stored procedure, my webform is giving me error ALTER PROCEDURE dbo.GetAllMessage AS SELECT MessageID, LEFT(Message, 80) AS Expr1 FROM MSGTble RETURN saying "A field or property with the name 'Message' was not found on the selected data source."

      M Offline
      M Offline
      Mycroft Holmes
      wrote on last edited by
      #2

      Remove the RETURN from your store proc.

      Never underestimate the power of human stupidity RAH

      M 1 Reply Last reply
      0
      • M Mycroft Holmes

        Remove the RETURN from your store proc.

        Never underestimate the power of human stupidity RAH

        M Offline
        M Offline
        Meax
        wrote on last edited by
        #3

        even after removing the "RETURN", still giving the same error

        R 1 Reply Last reply
        0
        • M Meax

          this works ok in sql server SELECT MessageID, LEFT(Message, 80) AS Expr1 FROM MSGTble but when i try to do it through stored procedure, my webform is giving me error ALTER PROCEDURE dbo.GetAllMessage AS SELECT MessageID, LEFT(Message, 80) AS Expr1 FROM MSGTble RETURN saying "A field or property with the name 'Message' was not found on the selected data source."

          A Offline
          A Offline
          Ashfield
          wrote on last edited by
          #4

          Its because you don't have a column called Message in your select statement, you alias it to Expr1, and I expect in your code you are referring to a column called Message.

          Bob Ashfield Consultants Ltd Proud to be a 2009 Code Project MVP

          1 Reply Last reply
          0
          • M Meax

            even after removing the "RETURN", still giving the same error

            R Offline
            R Offline
            Ramke
            wrote on last edited by
            #5

            Hi, if the column is not there you should get the error as invalid column. Try to execute the procedure within sql query analyzer window and check whether it returns any value correctly. In the query analyzer window you have to type the procedure name and excute it and see. It looks to me this could be coding problem on your webform. regards ramke

            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