Question
· Sep 6, 2022

"Insert into" using "stored procedure"

How can we insert into a table using a stored procedure

Table structure :

CREATE TABLE SampleHospital (
    Hospital VARCHAR(50),
    Location VARCHAR(50),
    UserName VARCHAR(50),
       UserFullName VARCHAR(70),
       LastLogin TIMESTAMP,
       LoginCount int)

 

Procedure Name:

call Custom_MENS_Other.samplesp('2021-11-02','2021-11-04','H001')

Product version: Caché 2018.1
Discussion (2)1
Log in or sign up to continue

If you can select from this stored procedure then you can try to use this select in INSERT into.

Does the following work?

SELECT * Custom_MENS_Other.samplesp('2021-11-02','2021-11-04','H001')

See Table-Valued functions section:
https://docs.intersystems.com/ens201815/csp/docbook/Doc.View.cls?KEY=RSQ...

And INSERT with SELECT:
https://docs.intersystems.com/ens201815/csp/docbook/DocBook.UI.Page.cls?...