Eddie Eddie - 1 month ago 7
SQL Question

Stored procedure insert into function

I have two tables


  • First table is
    CUSTOMERS
    with columns
    CustomerId, CustomerName

  • Second table is
    LICENSES
    with columns
    LicenseId, Customer



The column
Customer
in the second table is the
CustomerId
from the First table

I wanted to create a stored procedure that insert values into table 2

Insert into Licenses (Customer)
Values(CustomerId)


How can I get this data from the other table?

Thanks in advance for any help

Answer

this looks to me like simply a syntax question - I think what you want is

INSERT INTO Licenses (Customer) SELECT CustomerId FROM customers where ...
Comments