473,394 Members | 1,735 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Exactly like SQL Server table order

Hi
i have a code to retrieve table structures of SQL Server
database.
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")
DSNtest="DRIVER={SQL
Server};SERVER=SERVER;UID=sa;PWD=thanks;DATABASE=p arameter"
cn.open 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>")
Response.write("<tr><td><b>Field
Name</b></td><td><b>Data Type</b></td><td><b>Data Type
Length</b></td></tr>")
Set sysColumns = cn.Execute("SELECT A.name
As 'ColumnName', B.name 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 A.name")

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>")
sysColumns.movenext
loop
Response.write("</table>")
Response.write("<br><br>")
sysObjects.movenext
'end if
loop

cn.Close
Set cn = Nothing
%>

Thanks
Nov 21 '05 #1
0 974

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: laurie | last post by:
Hi all, I'm trying to help out a friend who has inherited a client with a PHP shopping cart application. Neither of us know PHP, but I've been muddling my way through, trying to get these old...
1
by: JackV | last post by:
Hi All, I have a pure asp (Vbscript) page that manipulates data between MSAccess and SQLServer2000. I'm trying to use the Scheduler app on the IIS server to run this page nightly but there must...
9
by: wiredog | last post by:
I am struggling rewriting my query from MS Access' IIF, Then to SQL Servers TSQL language. I am hoping some one can give me some guidance. I believe I have the first portion of the query correct...
10
by: Thomas Richards | last post by:
I have two SQL Server 2000 machines. The same file is sent nightly to each server and a stored proc uses BULK INSERT to load it into a staging table for processing. Once I've bcp'ed it in, I put...
2
by: maltchev | last post by:
i need to insert data from an xml file into sql server table. the xml file contains only one record. how to insert the data? how to map the names of the fields in the xml file and the table?...
5
by: hanolo | last post by:
Does anyone ever see this happen. I build a form with couple of textbox server control. When user inputs character ` in there, after form post back, the textbox become a line of string such as...
9
by: billmiami2 | last post by:
I was playing around with the new SQL 2005 CLR functionality and remembered this discussion that I had with Erland Sommarskog concerning performance of scalar UDFs some time ago (See "Calling...
8
by: rbg | last post by:
I did use query plans to find out more. ( Please see the thread BELOW) I have a question on this, if someone can help me with that it will be great. In my SQL query that selects data from table,...
3
by: graphicssl | last post by:
Okay, so first of all, I'm a designer first and a light coder second (I'm only really trained with HTML and CSS). So I apologize for having to post about something that's probably super-trivial! ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.