My environment, CFMX Prof, Windows XP Pro OS, MS SQL
Server 2000 DB server.

The following query executes fine with Query Analyzer
and the query execution shows up fine by CF debugging,
however, I got the following annoying err msg, please
note, I must use column alias for referencing later,
and if I don't use column alias the JDBC driver seems
to be OK but how come?  column alias is a simple
function with any DBMS, no reason JDBC driver fails to
support it.  Any one shied some light?  Thanks.

"Macromedia][SQLServer JDBC
Driver][SQLServer]Incorrect syntax near the keyword
'as'. 
...
<cfquery name="getStuff" datasource="#Attributes.ds#">
136 :           set nocount on
137 :           declare @obj varchar(150)
--------------------------------------------------------------------------------
 
SQL stmt ommitted here

DATASOURCE   XXXyyyZZZds 
VENDORERRORCODE   156 
SQLSTATE   HY000 
 

declare @obj varchar(150)
declare @col1 varchar(25)
declare @col2 varchar(350)
declare @col3 varchar(350)
declare @chkCols int

select @chkCols =
        (select count(name)
        from syscolumns
        where id = 2137058649);
        
select @obj =
(select name
from sysobjects
where id = 2137058649);         
select @col1 = 
        (select name
        from syscolumns
        where id = 2137058649
                and colid = 1);
select @col2 = 
        (select name
        from syscolumns
        where id = 2137058649
                and colid = 2);
select @col3 = 
        (select name
        from syscolumns
        where id = 2137058649
                and colid = 3);                 
        
set nocount off;
if (@chkCols >= 3)
        Begin
          EXEC('select ' + @col1 + ' as col1, ' + @col2 + '
as col2, ' + @col3 + ' as col3 from ' + @obj + ' order
by ' + @col2);  
        End
else
        Begin
          EXEC('select ' + @col1 + ' as col1, ' + @col2 + '
as col2 from ' + @obj + ' order by ' + @col2);                          
        End



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription: 
http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=4
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq

Your ad could be here. Monies from ads go to support these lists and provide more 
resources for the community. 
http://www.fusionauthority.com/ads.cfm

                                Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
                                

Reply via email to