# Define query tag using stored procedure

**URL:** <https://forum.inductiveautomation.com/t/define-query-tag-using-stored-procedure/42218>\
**Category:** Ignition\
**Created:** [January 13, 2021, 6:26pm UTC](https://forum.inductiveautomation.com/t/define-query-tag-using-stored-procedure/42218 "2021-01-13T18:26:44Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![SergioS](https://avatars.discourse-cdn.com/v4/letter/s/da6949/32.png) [@SergioS](https://forum.inductiveautomation.com/u/SergioS)\
**Post date:** [January 13, 2021, 6:26pm UTC](https://forum.inductiveautomation.com/t/define-query-tag-using-stored-procedure/42218/1 "2021-01-13T18:26:44Z")

</div>

Good morning,  
I’m trying to define a query tag ( DATATSET type) using stored procedure.

Stored procedure is ok if tested in SQL Manager, but when i go to use in query definition don’t work.

Here my definition for dataset

DECLARE @return\_value int

EXEC @return\_value = [dbo].[spDatasetTRS]  
@pGPlant = N ‘{[.]…/…/…/…/Plant}’,  
@pMaccha = N’{[.]…/…/MachineExt}’

Somebody can help me to understand why don’t work?

Thanks
