You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by "Gregor J. Rothfuss" <gr...@apache.org> on 2004/07/09 16:54:46 UTC

sql transformer problem with variable declarations

i am trying to run the following query against mssql using the
sql transformer. i never get results though, while i do get them
by using, say, mssql query analyzer. are there problems with these
kinds of variable assignments?

<?xml version="1.0" encoding="ISO-8859-1"?>
<root xmlns:sql="http://apache.org/cocoon/SQL/2.0">
   <sql:execute-query>
      <sql:query>
	declare @dt as datetime
	set @dt = getdate() - 1
	declare @startDt as datetime
	declare @endDt as datetime
			
	select @startDt =
	cast( cast(datepart(year, @dt) as varchar) + '-' +
	cast(datepart(month, @dt) as varchar) + '-' +
	cast(datepart(day, @dt) as varchar) + ' 00:00:00' as datetime),
	@endDt = getdate()
			
	select id, @startDt as startdate, @endDt as enddate,
         package from packageQueue
	where creatorView = '<sql:substitute-value sql:name="relevantView"/>'
	and lastUpdateTime between @startDt and @endDt
      </sql:query>
    </sql:execute-query>
</root>

note that i also didnt have luck with doing a query just on the first
part (until after @endDt = getdate())

any ideas?

-- 
Gregor J. Rothfuss
Wyona Inc.  -   Open Source Content Management   -   Apache Lenya
http://wyona.com                   http://cocoon.apache.org/lenya
gregor.rothfuss@wyona.com                       gregor@apache.org

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org