May 19, 2003 at 11:55 am
This produces the correct results when run from Query Analizer:
select name, xtype
from sysobjects
where xtype = 'U' and name <> 'dtproperties'
order by name
But uses the incorrect datasource when run from a Cold Fusion script:
<cfquery name="gettables"
datasource="exec_exec_test"
password="#password#"
username="#username#">
select name, xtype
from sysobjects
where xtype = 'U' and name <> 'dtproperties'
order by name
</cfquery>
It gives a result set showing spt_ only and not the user tables names.
May 19, 2003 at 2:45 pm
What database does the DSN point to? Is it the same as the one you are pointing to in Query Analyzer?
Either the data source has to be configured to point a particular default database or the login has to be set to one. Otherwise, you get the master database, where you wouldn't typically find any user objects.
K. Brian Kelley
http://www.truthsolutions.com/
Author: Start to Finish Guide to SQL Server Performance Monitoring
http://www.netimpress.com/shop/product.asp?ProductID=NI-SQL1
K. Brian Kelley
@kbriankelley
May 20, 2003 at 7:51 am
When I make the query fail by using a bad field name the debug data shows that the data source is indeed Exec_exec_test -- the same one that the query analizer is using.
May 20, 2003 at 7:51 am
When I make the query fail by using a bad field name the debug data shows that the data source is indeed Exec_exec_test -- the same one that the query analizer is using.
May 20, 2003 at 7:57 am
Query Analyzer connects to a server and you specify a database. A data source is in ODBC. Are the databases the same?
K. Brian Kelley
http://www.truthsolutions.com/
Author: Start to Finish Guide to SQL Server Performance Monitoring
http://www.netimpress.com/shop/product.asp?ProductID=NI-SQL1
K. Brian Kelley
@kbriankelley
May 20, 2003 at 10:13 pm
Yes, I run many queries from the user tables, but some how The datasource gets messed up when I want sysobject.
When I delibertly change a column name to a non existing I get an error, and can see the datasource is the one I specified.
The query works fine on the first database in a server, but none of the others.
Viewing 6 posts - 1 through 6 (of 6 total)
You must be logged in to reply to this topic. Login to reply