473,778 Members | 1,934 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.CreateOb ject("ADODB.Con nection")
Set cn = Server.CreateOb ject("ADODB.Con nection")
DSNtest="DRIVER ={SQL
Server};SERVER= SERVER;UID=sa;P WD=thanks;DATAB ASE=parameter"
cn.open DSNtest
Set sysObjects = cn.Execute("SEL ECT * 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("nam e")="dtproperti es" then

Response.write( "<table width='100%' border='1'>")
Response.write( "<tr><td colspan='3'><b> Table
Name:" & sysObjects("nam e") & "</b></td></tr>")
Response.write( "<tr><td><b>Fie ld
Name</b></td><td><b>Data Type</b></td><td><b>Data Type
Length</b></td></tr>")
Set sysColumns = cn.Execute("SEL ECT 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("nam e") & " table.</i></td></tr>")
end if

do until sysColumns.eof
Response.write( "<tr><td>" & sysColumns
("ColumnName ") & "</td><td>" & sysColumns("Dat aType")
& "</td><td>" & sysColumns("Dat aTypeLength")
& "</td></tr>")
sysColumns.move next
loop
Response.write( "</table>")
Response.write( "<br><br>")
sysObjects.move next
'end if
loop

cn.Close
Set cn = Nothing
%>

Thanks
Nov 21 '05 #1
0 991

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

Similar topics

3
3271
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 scripts working on a new server with the most recent version of PHP. I've pretty much taken care of all the various errors that were popping up. Most only pointed out out non-fatal undefined or assumed variables. I've been able to cure most of...
1
3091
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 be a better way of doing this. How can I make my code in to an object and install it on the server and have it schedule to run nightly?
9
2292
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 but do believe this requires a "NESTED" argument. This is where I am lost. My Original MS ACCESS Query reads-- SELECT DISTINCTROW REGION_TRAFIC.*, IIf(Mid(,5,2)=,
10
4505
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 it into a temp table with an IDENTITY column appended to it. (I need this identity column to group by later on to remove duplicates.) ie
2
52104
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? thank you in advance.
5
1733
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 <INPUT id=_txtName style="WIDTH: 70%" value=` name=_txtName>. I can filter out ` from the inputs, but it seems like a microsoft bug to me.
9
3314
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 sp_oa* in function" in this newsgroup). In that discussion, Erland made the following comment about UDFs in SQL 2005: >>The good news is that in SQL 2005, Microsoft has addressed several of these issues, and the cost of a UDF is not as severe...
8
2807
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, I have a where clause which states : where PermitID like @WorkType order by WorkStart DESC
3
3601
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! I'm working on setting up a shopping cart for a one-product web site, and I'm using HTML and CSS, with ASP for the shopping cart. The ASP takes the information from the form on the shopping cart, and formats it in to two e-mails: one for the company...
0
9629
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9465
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10127
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10068
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9923
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8954
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5370
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5497
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3627
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.