I am using the following code to list the fields in a database table. What I need to do though is know which ones are the ‘key’ fields. Can anyone help?
Thanks very much. Nathan
set conntemp=server.createobject(“adodb.connection”)
conntemp.open strCon
set rsTable=conntemp.execute(SQLStr)
for each FieldName in rsTable.fields
response.write FieldName.Name
next
rsTable.close
set rsTable=nothing
conntemp.close
set conntemp=nothing
set rsprimarykey = conn.execute("select * from information_schema.table_constraints where (table_name = '" & db & "') AND (constraint_type = 'Primary Key')")
set rsprimarykey2 = conn.execute("select column_name from information_schema.key_column_usage where (constraint_name = '" & rsprimarykey("constraint_name") & "')")
primarykey = rsprimarykey2("column_name")
[QUOTE=Nathan]
I am using the following code to list the fields in a database table. What I need to do though is know which ones are the ‘key’ fields. Can anyone help?
Thanks very much. Nathan
set conntemp=server.createobject(“adodb.connection”)
conntemp.open strCon
set rsTable=conntemp.execute(SQLStr)
for each FieldName in rsTable.fields
response.write FieldName.Name
next
rsTable.close
set rsTable=nothing
conntemp.close
set conntemp=nothing
[/QUOTE]
[QUOTE=Nathan]
That’s great - thanks “jonyah” It is exactly what we needed. With help from a mate Sofri, we now have the system working exactly as we wanted.
Again, thanks very much, pop down anytime to the taverna for a well deserved beer from me!