Results 1 to 2 of 2

Thread: basic query and CAST

  1. #1
    Join Date
    Jul 2003
    Posts
    1

    basic query and CAST

    I want to load all of the fields from a SQL database but 2 of the fields need to be changed via the CAST command.
    So far all I have is:
    SELECT CAST(var1 AS VARCHAR(30)) FROM table1") dsn(db1)

    This command only quesries the var1 field.
    1)How do I load the rest of the fields?
    2) How do I perform the same CAST manipulation to another variable at the same time?

    Thanks!

  2. #2
    Join Date
    Nov 2002
    Location
    New Jersey, USA
    Posts
    3,932
    You can use it as many times as you want in select statement

    SELECT CAST(var1 AS VARCHAR(30)),CAST(var2 AS VARCHAR(30)) FROM table1

Posting Permissions

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