#1  
Old 28th September 2006, 01:18 AM
Hans Hasenack
 
Posts: n/a
Default Metadata using SQL

If there a way -using SQL- to fetch the meta data for a database or table,
and return the results in a dataset form?

Result dataset could be something like this:

TableName FieldName FieldType FieldSize
TBLA ID AUTOINC
TBLA NAME VARCHAR 50
TBLB ID GUID
TBLB DESCR MEMO


TIA - Hans


  #2  
Old 28th September 2006, 01:29 AM
Ole Willy Tuv
 
Posts: n/a
Default Re: Metadata using SQL

Hans,

<< If there a way -using SQL- to fetch the meta data for a database or
table, and return the results in a dataset form? >>

You can check out the available metadata views by running:

select * from #meta

<< Result dataset could be something like this: >>

select * from #fields

Ole


  #3  
Old 28th September 2006, 08:04 AM
Hans
 
Posts: n/a
Default Re: Metadata using SQL

Thanks Ole, I knew it wouldnt be hard...

Hans


  #4  
Old 29th September 2006, 01:56 AM
Hans Hasenack
 
Posts: n/a
Default Re: Metadata using SQL

Yes!

Select * from #SCHEMAS gives me a nice result set of aliases and ther
folders...

So why is the next statement giving me an error?

INSERT INTO #SCHEMAS VALUES ('TEST','C:\TEST')

NexusDB: Query586651328: Invalid handle to the function. [$2706/9990]

Or is this statement invalid in SQL anyway? I can imagine it being possible
to add, modify and delete an alias using SQL this way...

DELETE FROM #SCHEMAS WHERE SCHEMA_NAME='TEST'

By the way, returns the same invalid function error.


  #5  
Old 29th September 2006, 02:03 AM
Ole Willy Tuv
 
Posts: n/a
Default Re: Metadata using SQL

Hans,

<< Select * from #SCHEMAS gives me a nice result set of aliases and ther
folders...

So why is the next statement giving me an error?

INSERT INTO #SCHEMAS VALUES ('TEST','C:\TEST')

NexusDB: Query586651328: Invalid handle to the function. [$2706/9990] >>

The metadata views are read-only in-memory tables. You can only query these
views.

Ole


  #6  
Old 29th September 2006, 08:19 AM
Hans Hasenack
 
Posts: n/a
Default Re: Metadata using SQL

What a pity.. It would have been a great option to add aliases etcetera
using SQL....



  #7  
Old 29th September 2006, 08:32 AM
Ole Willy Tuv
 
Posts: n/a
Default Re: Metadata using SQL

Hans,

<< What a pity.. It would have been a great option to add aliases etcetera
using SQL.... >>

Well, I don't think any RDBMS would allow users to directly manipulate the
system tables (metadata). The system tables are updated by the database
server as an effect of users running DDL statements.

I believe NexusDB V3 might support CREATE CATALOG and CREATE SCHEMA
statements.

Ole


  #8  
Old 29th September 2006, 09:50 AM
Hannes Danzl[NDD]
 
Posts: n/a
Default Re: Metadata using SQL

> I believe NexusDB V3 might support CREATE CATALOG and CREATE SCHEMA
> statements.


Very likely yes.

--

Hannes Danzl [NexusDB Developer]
Newsgroup archive at http://www.tamaracka.com/search.htm
  #9  
Old 29th September 2006, 05:43 PM
Martijn Tonies
 
Posts: n/a
Default Re: Metadata using SQL


> << What a pity.. It would have been a great option to add aliases etcetera
> using SQL.... >>
>
> Well, I don't think any RDBMS would allow users to directly manipulate the
> system tables (metadata).


InterBase and Firebird do, although Jim Starkey now says it was a bad idea
:-)

MS SQL Server does, if you turn it "on" so that it allows you to.


>The system tables are updated by the database
> server as an effect of users running DDL statements.


Having an extensive set of DDL statements is by far the best way. Having
them under transaction control is even better.


--
Martijn Tonies
Database Workbench - tool for InterBase, Firebird, MySQL, NexusDB, Oracle &
MS SQL Server
Upscene Productions
http://www.upscene.com
My thoughts:
http://blog.upscene.com/martijn/
Database development questions? Check the forum!
http://www.databasedevelopmentforum.com




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Metadata query returns wrong results Martijn Tonies nexusdb.public.support.sql 4 13th September 2006 01:55 AM
Password encrypted tables and #tables/etc metadata Martijn Tonies nexusdb.public.support.sql 4 14th October 2005 05:28 PM
Metadata - DataDictionary Ole Willy Tuv nexusdb.public.support.sql 1 2nd October 2003 03:57 PM


All times are GMT +11. The time now is 06:38 PM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.