Results 1 to 3 of 3

Thread: Inset Question

  1. #1
    Join Date
    Nov 2002
    Posts
    2

    Inset Question

    Hi,
    I want to insert three values into a table ( say TableA ). One of the values is the result of a select on TableB and the other two are hard coded values. Both tables are joined ok.

    The SQL definition for insert says either

    insert table(col1, col2, ...) values(...)

    or

    insert table(col1, col2, ...) select .....


    my requirement seems to be a combination of the two. In Psuedo code

    insert into TableA(col1, col2, col3) select colA from TableB where ..., 99, 99

    Can the insert be done in one command?

    Many thanks

    Lenin

  2. #2
    Join Date
    Sep 2002
    Location
    Amsterdam
    Posts
    53
    This should work:

    insert into TableA(col1, col2, col3) select colA ,99,99 from TableB where ....

  3. #3
    Join Date
    Nov 2002
    Posts
    2
    Thought I had tried this, obviously not, it worked fine. Many thanks.

Posting Permissions

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