Skip to main content
Question

Extract table name and primary key within database

  • June 27, 2019
  • 1 reply
  • 178 views

boubcher
Contributor
Forum|alt.badge.img+11

Hello there

I am looking to extract tables name and primary keys of a database in order to use it on the other workspace

Any idea, please

1 reply

mark2atsafe
Safer
Forum|alt.badge.img+44

I don't know if you want to automate this or just get a list, but databases usually include a system table that lists all user tables. 

For example in SQL Server this command should return a list of tables:

SELECT TABLE_NAME 
FROM <DATABASE_NAME>.INFORMATION_SCHEMA.TABLES 
WHERE TABLE_TYPE = 'BASE TABLE'

You could put that into FME in a SQLCreator transformer, and then you'll get a list of tables each as a separate FME feature.

I don't know what else is stored in that table, but I expect primary key would be another piece of available information.


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings