List invalid table and fieldnames - Regular Expressions used

English version at the end - as usual

Hi,

ich musste heute testen, ob bzw. welche Feld- und Tabellennamen "ungültige" Zeichen (wie Leerzeichen etc.) enthalten.
Bei dieser Gelegenheit habe ich "Regular Expressions" eingesetzt.
Das Ergebnis habe ich in eine Access-Demo-Datenbank "gegossen".

Diese Demo-Datenbank ist in meinem Ondrive im Verzeichnis Accesss_DBs unter RegEx_ListAllFieldnames.accdb zu finden

Diese kleine Datenbank zeigt einige Dinge:
a) Einfache Verwendung "Regular Expressions" (regulärer Ausdrücke)
b) Auflistung aller Tabellen und Feldnamen in MSAccess
c) Auflistung aller Tabellen und Feldnamen in MSSQL Server (als View)
d) Wie kann man testen, ob Tabellen- und Feldnamen nicht "verbotene" Zeichen enthalten, insbesondere "Leerzeichen", "Bindestrich", "Schrägstrich" usw.? Die deutschen Umlaute sind zulässig und es werden korrigierte Feld- und Tabellennamen vorschlagen (ungültige Zeichen werden durch Unterstrich ersetzt)

---------------------------------------------------------------------

a) Regular Expressions: Solange das vollständige VBSCRIPT installiert ist, funktioniert dies, da RegEx Teil von VBSCRIPT ist
Das Modul "mdl_Regular_Expressions" enthält zwei funktionsbereite Funktionen die sowohl die Auswahl als auch die Ersetzung von Zeichenfolgen mit Regex zeigen.
Die Abfragen "... Invalid..names" zeigen, wie beide verwendet werden.

b) Das Modul mdl_ListAllAccFieldNames erstellt die Tabelle _tblTabFelder, die alle Tabellen- und Feldnamen von MSAccess-Tabellen enthält
 - und bei korrekter Verknüpfung auch die verknüpften Tabellen. Leider sind die vorhandenen MSAccess Meta-Daten nicht direkt als Abfrage verfügbar.

c) Das Modul INFO__SQL_VIEW___qry_All_Tables_Columns enthält eine MSSQL-View, in der alle Tabellen- und Feldnamen der MSSQL-Datenbank erstellt werden.

d) Die 4 "qry ... Invalid ... Names" Abfragen zeigen nur diejenigen Feldnamen, die "falsche" Werte besitzen, an. In der letzten Spalte wird eine "korrigierte Version" angezeigt.
Wie dies ausgeführt wird, wird im Modul mdl_Regular_Expressions angezeigt, da jede Abfrage beide Funktionen enthält.

 Makro Autoexec: Es ruft einfach automatisch die Funktion "TableInfo_AllTabs" des Moduls mdl_ListAllAccFieldNames auf
Es erstellt und füllt die Tabelle "_tblTabFelder", mit der Sie die beiden MSAccess-Abfragen ad hoc ausführen können.

 Die verknüpfte Tabelle "qry_All_Tables_Columns" funktioniert nicht direkt für Sie. Sie müssen zuerst die View auf dem MSSQL-Server erstellen und dann die View als Tabelle in MSAccess neu verknüpfen.

mfg Klaus

-------------------------------------------------------------------------------------------------------------------------------------

Hi,

Today I had to test whether or which field and table names contain "invalid" characters (such as spaces, etc.).
On this occasion I used "Regular Expressions".
I poured the result into an Access demo database.

This demo database can be found in my OneDrive in the Accesss_DBs directory under RegEx_ListAllFieldnames.accdb

This small Database will show several things:
a) Easy using of Regular Expressions
b) Listing of all Tables and Fieldnames in MSAccess
c) Listing of all Tables and Fieldnames in MSSQL Server (as View)
d) How to test table- and field-names to not contain "forbidden" characters, especially "blank", "hyphen", "slash" etc. The German umlauts are allowed
and suggest corrected field- and table-names (invalid chars are replaced by Underline)

---------------------------------------------------------------------

a) Regular Expressions: As Long as the complete VBSCRIPT is installed on the system, this will work, as RegEx is part of VBSCRIPT
The module "mdl_Regular_Expressions" contains two ready to use functions to select and replace strings with Regex
The queries "...Invalid..names" show how to use both functions.

b) The module mdl_ListAllAccFieldNames creates the table _tblTabFelder which containes all table- and field-names of MSAccess tables
- and if correctly linked - also the linked tables. Unfortunately, the existing MSAccess meta-data is not directly available as a query.

c) The INFO__SQL_VIEW___qry_All_Tables_Columns module containes an SQL Server View which creates all table- and field-names of the MSSQL database.

d) The 4 "qry...Invalid...names" Queries show only incorrect names, and the last column shows the "corrected version"
how its done is showed in the module mdl_Regular_Expressions, as each query contains both functions.

Macro Autoexec: It just automatically calls the function "TableInfo_AllTabs" of module mdl_ListAllAccFieldNames
The table "_tblTabFelder" is created and filled, so that you can run the two MSAccess queries ad hoc ...

The linked table "qry_All_Tables_Columns" will not work for you directly, you first have to create the view on the server and then relink the view as table in MSAccess.

best regards Klaus