By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
449,024 Members | 924 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 449,024 IT Pros & Developers. It's quick & easy.

Exactly like SQL Server table order

P: n/a
i have a code to retrieve table structures of SQL Server
It gives all the table names in particular databse with
the column names and datatypes also.
But the output displays not in the exact order of what i
am designing in SQL Server database,mainly coulmnnames are
not in order.
I want to displayed output exactly like what i was
designed in SQL Server table.
How can i displyed like that is there any solution?
Please give me reply.
The code is:

'Set Conn = Server.CreateObject("ADODB.Connection")
Set cn = Server.CreateObject("ADODB.Connection")
Server};SERVER=SERVER;UID=sa;PWD=thanks;DATABASE=p arameter" DSNtest
Set sysObjects = cn.Execute("SELECT * FROM sysObjects
WHERE xtype = 'U' ORDER BY name")

If sysObjects.eof Then
Response.write("No records returned")
End If

do until sysObjects.eof
'if not sysObjects("name")="dtproperties" then

Response.write("<table width='100%' border='1'>")
Response.write("<tr><td colspan='3'><b>Table
Name:" & sysObjects("name") & "</b></td></tr>")
Name</b></td><td><b>Data Type</b></td><td><b>Data Type
Set sysColumns = cn.Execute("SELECT
As 'ColumnName', As 'DataType', A.length
As 'DataTypeLength' FROM sysColumns As A INNER JOIN
sysTypes As B On (A.xtype = B.xtype) WHERE id = " &
sysObjects("id") & " ORDER BY")

if sysColumns.eof Then
Response.write("<tr><td><i>No columns
found for " & sysObjects("name") & " table.</i></td></tr>")
end if

do until sysColumns.eof
Response.write("<tr><td>" & sysColumns
("ColumnName") & "</td><td>" & sysColumns("DataType")
& "</td><td>" & sysColumns("DataTypeLength")
& "</td></tr>")
'end if

Set cn = Nothing

Nov 21 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.