# The statement did not return a result set - MS SQL and data density binding

**URL:** <https://forum.inductiveautomation.com/t/the-statement-did-not-return-a-result-set-ms-sql-and-data-density-binding/22875>\
**Category:** Ignition\
**Tags:** ignition79\
**Created:** [February 26, 2019, 2:02pm UTC](https://forum.inductiveautomation.com/t/the-statement-did-not-return-a-result-set-ms-sql-and-data-density-binding/22875 "2019-02-26T14:02:08Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![bkarabinchak.psi](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/bkarabinchak.psi/32/83567_2.png) [@bkarabinchak.psi](https://forum.inductiveautomation.com/u/bkarabinchak.psi)\
**Post date:** [February 26, 2019, 2:02pm UTC](https://forum.inductiveautomation.com/t/the-statement-did-not-return-a-result-set-ms-sql-and-data-density-binding/22875/1 "2019-02-26T14:02:08Z")

</div>

I have a date range object with the date density binding to a stored procedure -

```auto
execute spWorkOrdersDateRangeDensity '{Root Container.Filter.Date Range.startDate}', '{Root Container.Filter.Date Range.endDate}'

```

Copying a string version of the query that appears in my error message works in my MSSQL studio however. The actual stored prrocedure is such -

```auto
ALTER PROCEDURE [dbo].[spWorkOrdersDateRangeDensity] (
	@startS varchar(50),
	@endS varchar(50)
	)
AS

BEGIN

declare @startDT smalldatetime
declare @endDT smalldatetime

Set @startDT = cast(@startS as smalldatetime)
Set @endDT = cast(@endS as smalldatetime)

declare @returnTable table([t_stamp] date, [weight] int)
declare @idx bigint
declare @createDate smalldatetime
declare @t_stamp smalldatetime
declare @completedDate smalldatetime

select @idx = min([idx]) from workorders where [createDate] < [completedDate] and [createDate] >= @startDT and [createDate] <= @endDT

while @idx is not null
	begin
		select @createDate = [createDate], @completedDate = [completedDate] from workorders where idx = @idx
		select @t_stamp = @createDate
		while @t_stamp <= @completedDate
			begin
				insert into @returnTable([t_stamp], [weight]) Select @t_stamp, 1
				Set @t_stamp = dateadd(mi, 10, @t_stamp)
			end
		select @idx = min(idx) from workorders where idx > @idx
	end

insert into @returnTable([t_stamp], [weight]) Select @endDT, 0

return select top 1000 [t_stamp], [weight] from @returnTable order by [t_stamp]

END

GO

```

Why is this giving met his error?

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [February 26, 2019, 6:41pm UTC](https://forum.inductiveautomation.com/t/the-statement-did-not-return-a-result-set-ms-sql-and-data-density-binding/22875/2 "2019-02-26T18:41:36Z")

</div>

Try removing the “return” from before your final “select”.
