Results 1 to 3 of 3
  1. #1
    Join Date
    Jan 2003
    Location
    Atlanta
    Posts
    134

    Unanswered: SQL query use in insert values

    Can I use like
    insert into table1 values ('select max(col1) from table1', ....)

    The real question is can a select statement used while inserting rows into a table?

    Any help is appreciated.

  2. #2
    Join Date
    Dec 2002
    Location
    Antwerp, Belgium
    Posts
    227
    yes, this is possible. Just make sure that your insert and your select statement have the same number of columns and the same data types.
    In BOL are some examples, just look for "insert..select" in the index.
    Johan

  3. #3
    Join Date
    Jul 2003
    Location
    San Antonio, TX
    Posts
    3,662
    you'll have to remove VALUES clause.

Posting Permissions

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