HL7 SPQ_Q08 Stored Procedure Request

HL7 message structure SPQ_Q08 groups and segments from HL7 v2.5.1 Hide structure

These are the generated groups and segments for the version selected at the top of the page. The article explains the workflow, and this panel follows the chosen HL7 version.

Message Structure

SegmentNameRequiredRepeatable
Message Header Yes No
Software Segment No Yes
SPR Yes No
Table Row Definition No No
Continuation Pointer No No

SPQ_Q08 sends a stored procedure request in an SPR segment. The query name and parameters are not self-describing enough by themselves; the sender and receiver need a shared contract for what the procedure does and what every parameter means.

This is a legacy query pattern. It can be effective inside a controlled private interface, but it is not a good open-ended integration style.

A small SPQ Q08 example

MSH|^~\&|PORTAL|CITYHOSP|RESULTS|CITYHOSP|20260718154000||SPQ^Q08^SPQ_Q08|SPQQ080001|P|2.5.1 SPR|QPROC001|R|RECENT_RESULTS^Recent results procedure^L|MRN^123456^^^CITYHOSP^MR~SINCE^20260701000000 RDF|3|ResultCode^CE^80~ResultValue^ST^40~ResultTime^DTM^24

What systems do with it

The requester asks the responder to run a named procedure and return data in an agreed format. Optional RDF can describe the row definition expected in a tabular response. DSC can support continuation.

In real systems, the stored procedure name is often a stable logical name rather than a literal database procedure. That is safer and gives the responder room to change implementation without breaking the interface.

How to read the structure

MSH identifies SPQ^Q08^SPQ_Q08. SPR carries the query tag, response format, stored procedure name, and input parameter list. RDF can describe columns expected in a tabular response.

Implementation traps

Do not expose arbitrary procedure execution. Map incoming names to an allowlist, validate every parameter, and audit who asked for what.

Also version the parameter list. Positional parameters are brittle; one added field can make every old sender subtly wrong.

Reference notes

HL7 v2.3.1 event Q08 is the stored procedure request. See the HL7 Q08 event page.