I think the same answer is implied in Hassan's answer as well..

It would seem that you have told the DBMS to create a local variable and
put the query results in the local variable then end, thus losing the
local variable.

If you want to refer to the result then Hassan's code looks good!

Michael Traher

-----Original Message-----
From: Chris More [mailto:[EMAIL PROTECTED]
Sent: 24 November 2003 15:50
To: CF-Talk
Subject: Declared SQL variables in select statement error

Why can I execute this statement fine in MS SQL Analyzer:

DECLARE @q1 varchar(7)

SELECT @q1 = period_name
FROM adj_periods
WHERE period_id = 1

And If I try to do this in CF:

<cfquery name="sales" datasource="forecasting"
DECLARE @q1 varchar(7)

SELECT @q1 = period_name
FROM adj_periods
WHERE period_id = 1
</cfquery>

I get this error:

QUERY The QUERY attribute of the tag does not specify the name of an
available query

This is a simplified version of my problem, but it seems that CF will
execute the query without an error but the returned query structure
won't exist at all.

Has anyone else ran into this problem?

Thanks,
Chris
[EMAIL PROTECTED]

  _____  


[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]

Reply via email to