Ask a Question related to Coldfusion Database Access, Design and Development.
-
woddel #1
sp_columns for microsoft access
hello all
in sql server, i can us the stored procedure sp_columns to get the table
information (rownames, type, length etc) of a 'unknown' table. now, i need to
write a routine to import tables from microsoft access databases into sql
server. but sp_columns does not work on access.
how can i tickle that information out of access using coldfusion and
sql-queries? anybody any wiser than me? :)
cheerios
lukas @ switzerland
woddel Guest
-
[microsoft][odbc microsoft access driver] syntax error (missing operator) in query expression error
I have a query I want to run using DBQwiksite siftware, which produces the syntax error (missing operator) in query expression error when... -
[Microsoft][ODBC Microsoft Access Driver] Could not start session.
Does anyone know what this problem means??? Microsoft OLE DB Provider for ODBC Drivers error '80004005' Could not start session. ... -
[Microsoft][ODBC Microsoft Access Driver]'(unknown)' is not a valid path error
This is probably an old problem that most of you know how to fix (I hope!). The scenario is that I have a web server running an ASP site that needs... -
ASP Microsoft Access
I am writing an sites for mulitple languages, even though in the script I tell the encoding type to be for the language in Microsoft Access it... -
Microsoft Access with ASP.net
Is it possible to use ASP.net with Microsoft Access. From what I can find ASP.net only works with SQL server. That's kind of step backward from... -
philh #2
Re: sp_columns for microsoft access
There are no straight SQL queries to return Access table schema; it's not available through the ODBC driver. You have to use VB/ADO to get the info.
philh Guest
-
efecto747 #3
Re: sp_columns for microsoft access
It can be done but its pretty messy - firstly you can get table names from the
MSysObjects table - this is normally hidden but you can show it through the
options menu. The following query will give you all table names:
SELECT Name
FROM MSysObjects
WHERE Type = 1
You then need to select one row of data (use maxrows=1) from each table and
serialise it using wddx. This reveals column names in their correct order and
also shows the data types.
Below is a snippet of code I used to use to get this info from an Access 97
database the field names are stored as a list in #fieldnames# and data types in
#fieldtypes# - hope this helps.
cheers.
<cfquery name="qryColumns" datasource="#dsn#" maxrows="1">
SELECT * FROM #tablename#
</cfquery>
<!--- convert any dates so that wddx serialisation doesn't crash.. --->
<cfloop index="cname" list="#qryColumns.ColumnList#">
<cfif IsDate(Evaluate("qryColumns."& cname))>
<cfset "qryColumns.#cname#" = DateFormat(Evaluate("qryColumns."&
cname),"yyyy-mm-dd") & " " & TimeFormat(Evaluate("qryColumns."&
cname),"HH:MM:SS")>
</cfif>
</cfloop>
<!---
make into wddx packet so that column names are put into correct order
and also so we can identify the data type of each column
--->
<cfwddx action="cfml2wddx" input="#qryColumns#" output="qWDDX">
<cfset fieldnames = "">
<cfset fieldtypes = "">
<cfset nextpos = FindNoCase("<field name='", qWDDX, 1)>
<cfloop condition="nextpos neq 0">
<cfset nextpos = nextpos + 13>
<cfset endpos = FindNoCase("'", qWDDX, nextpos)>
<cfset fieldlen = endpos - nextpos>
<cfset fieldnames = fieldnames & Mid(qWDDX, nextpos, fieldlen) & ",">
<cfset nextpos = endpos + 3>
<cfset endpos = FindNoCase(">", qWDDX, nextpos)>
<cfset fieldlen = endpos - nextpos>
<cfset fieldtypes = fieldtypes & Mid(qWDDX, nextpos, fieldlen) & ",">
<cfset nextpos = FindNoCase("<field name='", qWDDX, nextpos)>
</cfloop>
efecto747 Guest



Reply With Quote

