Created
September 17, 2019 12:09
-
-
Save mrandrewmills/b5c3cc779872d07be9017566443caca2 to your computer and use it in GitHub Desktop.
When you don't have DB access, but need to see the tables & field names with which you are working.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!--- change datasource as needed ---> | |
<cfset thisDatasource = "example"> | |
<!--- retrieve and display all table names in order ---> | |
<cfquery name="getAllTableNames" datasource="#thisDatasource#"> | |
SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_TYPE='BASE TABLE' | |
ORDER BY Table_Name | |
</cfquery> | |
<cfdump var="#getAllTableNames#" label="getAllTableNames" expand="false"> | |
<!--- show one record from each table, provide insight into its structure ---> | |
<cfloop query="getAllTableNames"> | |
<cfquery name="thisTable" datasource="#thisDatasource#"> | |
SELECT TOP 1 * FROM #table_name# | |
</cfquery> | |
<cfdump var="#thisTable#" label="#table_name#" expand="true"> | |
</cfloop> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment