sql - procedure to take information from one table and write to another table -
ive got question stumped on. reads follows:
write import stored procedure take information table (source) , write table (target).
im guessing following:
create procedure add_data(@name, @surname) begin select name, surname cardholder insert new_table values (name, surname)
is logic correct or missing it?
you there. since directly copying 1 table another, can use insert ... select ...
idiom, so:
create procedure add_data @name varchar(100) @surname varchar(100) begin insert new_table(name,surname) select name, surname cardholder end
note 2 changes made:
- how declare parameters sp
- the
values
clause should consist of actual values being inserted. since inserting data retrieved table rather fixed values, useselect
query instead.
Comments
Post a Comment