Home Page for the TeradataForum
 

Archives of the TeradataForum

Message Posted: Fri, 23 Mar 2007 @ 08:55:34 GMT


     
  <Prev Next>   <<First <Prev
Next>
Last>>
 


Subj:   Re: How to get column types in views
 
From:   McCall, Glenn David

If you are using ODBC (or JDBC or CLI for that matter) what you need to do is:

1) Prepare a relevant query (e.g. select * from some_view) - consult the documentation on how to do this.

2) Obtain the result set meta data from the returned prepared object.


NB: You will likely find that you can only prepare a query using the lower level API's such as ODBC directly or maybe RDO. ADO, DAO and other higher level technologies are unlikely to provide the prepare capability.

The result set metadata contains all sorts of usefull information (or useless information, depending upon your outlook) including number of columns (really useful for a select * query), data types, column names (again useful for a select *), precision, nullable indicators and many others.

You can obtain similar meta data information by actually running the query. However the problem (as you point out) is that the query runs and can take a long time. A prepared query is one that is prepared to run, but is not actually run. Performance is similar to that of obtaining an Explain for the same query (which effectively "prepares" the query, but more importantly doesn't actually run it). Thus no matter how complex your query or how complex the underlying view is, you can expect a good response time using the above approach.

I don't know how queryman (SQL Assistant) does the equivalent function, but if I were to bet, I would bet that it does it using a method very similar to the one I describe above.


I hope this helps

Glenn Mc



     
  <Prev Next>   <<First <Prev
Next>
Last>>
 
 
 
 
 
 
 
 
 
  
  Top Home Privacy Feedback  
 
 
Copyright for the TeradataForum (TDATA-L), Manta BlueSky    
Copyright 2016 - All Rights Reserved    
Last Modified: 15 Jun 2023