Using a stored procedure to write XML to SQL
You can use a stored procedure to write XML results to SQL Server by checking the Use a stored procedure to write XML results checkbox (on the Schema Structure tab) and then clicking the Params button to define the stored procedure's name and its arguments (the xml results , i.e.,
By clicking on the New... button, you can define a new stored procedure argument by giving it a Name (must be unique within the arguments for this stored procedure; doesn't have to match the actual name of the stored procedure argument in SQL Server, just its type), and then selecting an XML path (XPATH) from the XML Output Linkage's Schema -- this is where the value will come from. Make sure that the type value pointed to by the XPATH (number, string, date) is the "same" as the type as the stored procedure's argument in SQL Server.
After you define the stored procedure's arguments, then you can click on the Re-Order Arguments button to put them into the same order as the stored procedure's arguments in SQL Server (this information can be supplied by your DBA).
When writing the stored procedure, if there's a problem with one of the arguments or assumptions (e.g., this stored procedure shouldn't be run on Plan 132), we suggest checking for those error conditions in the stored procedure (within SQL Server) and then using the SQL function RAISERROR to issue an appropriate error message. For example,
RAISERROR ('You cannot use this stored procedure when the PlanID is 132',16, 1)
where the second argument 16 indicates that this is a user defined error message (vs a SQL Server error message). When this error is generated in SQL, ProAdmin will show the user this error message so they can figure out how to fix the error.