473,396 Members | 2,018 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,396 software developers and data experts.

Get text of Table Structure

Terry Kreft was nice enough to put this code together that creates a
text file of all the SP's, Views and User Defined Functions in a
project.

Is there a way to do the same for all of the tables, getting the table
names with all of their columns and column specs?

lq

Because you are using a SQLDMO.Database object when you should be using
a
SQLDMO.Database2 object.

So your procedure should be somthing like
Sub OutputDBQueries(myPath As String)
Dim strSep As String
Dim objSQLServer As New SQLDMO.SQLServer
Dim dbs As New SQLDMO.Database2
Dim sp As SQLDMO.StoredProcedure
Dim v As SQLDMO.View
Dim f As SQLDMO.UserDefinedFunction
Dim sptext As String
strSep = vbCrLf & vbCrLf & vbCrLf _
& String(78, "*") _
& vbCrLf & vbCrLf & vbCrLf
objSQLServer.Connect <Servername>, <Username>, <Password>
Set dbs = objSQLServer.Databases(<Databasename>)
Open myPath For Output As #1
'>go through all stored procedures:
For Each sp In dbs.StoredProcedures
sptext = sp.Text
Print #1, sptext & strSep
Next
'>go through all views:
For Each v In dbs.Views
sptext = v.Text
Print #1, sptext; strSep
Next
For Each f In dbs.UserDefinedFunctions
sptext = f.Text
Print #1, sptext; strSep
Next
MsgBox "The export is completed." & vbCrLf & vbCrLf & _
"Your export file has been created in: " & vbCrLf & _
myPath, vbInformation, "Export Completed"
End Sub

Sep 18 '06 #1
1 3666
I do have a SQL output utility on my site

http://www.heuveltop.nl/BasCB/msac_index.html

See Code modules, SQL-Tool

Lauren Quantrell schreef:
Terry Kreft was nice enough to put this code together that creates a
text file of all the SP's, Views and User Defined Functions in a
project.

Is there a way to do the same for all of the tables, getting the table
names with all of their columns and column specs?

lq
--
Bas Cost Budde
Holland
Sep 18 '06 #2

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

Similar topics

18
by: Wade Leftwich | last post by:
Every couple of months I have a use for the experimental 'scanner' object in the re module, and when I do, as I did this morning, it's really handy. So if anyone is counting votes for making it a...
7
by: Santah | last post by:
hi I'm new to C++ and I'm currently working on Visual C++ 6.0 I'm trying to open a text file, and read some data from it part of the text file looks like this: --------
2
by: Joel | last post by:
Hi, I'm importing our DOS data base (Dataflex) to Mysql I have a table with 174,638 records that I convert into a tab delimetered Text file however, Mysql only reads 87,035! I checked the text...
7
by: Rick Caborn | last post by:
Does anyone know of a way to execute sql code from a dynamically built text field? Before beginning, let me state that I know this db architecture is built solely for frustration and I hope to...
1
by: js | last post by:
I am trying to build a query on a SQL2000 text field which contains XML string. The query is like "select requestnumber from history where requestnumber is like '%re1%'". As you can see in the...
7
by: Marios Koumides | last post by:
I post the same question few days ago but there was a confusion in the answers. Anywayz I am posting again. I have a form with 96 textboxes (8 rows x 12 columns) Now I want in the last row to have...
13
by: Shannan Casteel via AccessMonster.com | last post by:
I set up two tables (one with the regular claim info and another with ClaimNumber, PartNumber, and QuantityReplaced). The ClaimNumber is an autonumber and the primary key in both tables. I made a...
60
by: Julie | last post by:
What is the *fastest* way in .NET to search large on-disk text files (100+ MB) for a given string. The files are unindexed and unsorted, and for the purposes of my immediate requirements, can't...
7
by: mykathy127 | last post by:
hi, im setting up a database that will join the contents of 2 tables once this text is found on the other table. for example: table 1 will contain the following: Structure Column...
0
by: JosAH | last post by:
Greetings, Introduction At the end of the last Compiler article part I stated that I wanted to write about text processing. I had no idea what exactly to talk about; until my wife commanded...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
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...
0
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,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.