Restricting Characters

Results 1 to 2 of 2

Thread: Restricting Characters

  1. #1
    Join Date
    Dec 1969

    Default Restricting Characters

    When querying character fields in a database. Is there a way of restricting the number of characters brought back. e.g. I have a table containing place names e.g. OLDHAM, but when querying the table, I only want to return the first 3 characters, i.e. OLD

  2. #2
    Join Date
    Dec 1969

    Default substring

    Most dbms have support for a substring function, the syntax may vary between then. One of these will probably do<BR><BR>select substring(placeName,1,3) as name from places<BR><BR>select substr(placeName,1,3) as name from places<BR><BR>select left(placeName,3) as name from places<BR><BR>select substring(placeName from 1 for 3) as name from places

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts