Results 1 to 3 of 3

Thread: Inserting spaces between 2 fields

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Dec 1999
    Location
    Itabirito,Minas Gerais, Brazil
    Posts
    79

    Post

    Hi, people,

    I have a SQL statment as record source of a DATA Control. I'm trying to insert a space between 2 fields, using this SQL:

    If I use:
    SELECT GroupID, GroupCode & GroupDescri AS Expr1
    FROM Grupos
    ORDER BY GroupCode WITH OWNERACCESS OPTION;
    it works,

    but if I use
    SELECT GroupID, GroupCode & " " & GroupDescri AS Expr1
    FROM Grupos
    ORDER BY GroupCode WITH OWNERACCESS OPTION;
    it returns a error messages (too few parameters, expect 1)

    I've already tried to use str(GroupCode), cause GroupCode is a numeric field:
    SELECT GroupID, str(GroupCode) & " " & GroupDescri AS Expr1
    FROM Grupos
    ORDER BY GroupCode WITH OWNERACCESS OPTION;
    Same error

    If I use:
    SELECT GroupID, GroupCode & " " & 'GroupDescri' AS Expr1
    FROM Grupos
    ORDER BY GroupCode WITH OWNERACCESS OPTION;
    same error.

    What I am doing wrong?

    Thanks in advance,
    Roselene

  2. #2
    Lively Member
    Join Date
    Feb 2000
    Location
    Glasgow, Scotland
    Posts
    71

    Post

    It will depend on the type of database you are connecting to but if I was doing it for oracle the statement would read,

    select SELECT GroupID, (GroupCode | | " "" | |GroupDescri) AS Expr1
    FROM Grupos
    ORDER BY GroupCode WITH OWNERACCESS OPTION;

    It is important to put the parentheses around the expression.

    Hope this helps

    Chris

  3. #3
    Lively Member
    Join Date
    Dec 1999
    Location
    Karlsruhe, Germany
    Posts
    122

    Post

    Hi,

    try

    Code:
    SELECT GroupID, GroupCode & ' ' & GroupDescri AS Expr1
    FROM Grupos
    ORDER BY GroupCode WITH OWNERACCESS OPTION;

Posting Permissions

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



Click Here to Expand Forum to Full Width