embed select statment within a insert statement?

  • Does anyone know if sql server has the capacity to embed a select statement within a value in the insert statement?

    insert into table1

    (

    report_date,

    employee

    )

    values

    (

    select rpt_dt from reports where rpt_dt = somevalue,

    select emp from employees where emp = id

    )

    Thanks

  • Try

    insert into table1

    (

    report_date,

    employee

    )

    select rpt_dt, (select emp from employees where emp = id)

    from reports where rpt_dt = somevalue

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply