Solved

DBCC DBREINDEX  and VB6

Posted on 2006-11-21
3
637 Views
Last Modified: 2013-12-25
When you run
DBCC DBREINDEX ('pubs.dbo.authors', UPKCL_auidind, 0)
In Enterprise Manager you get the following results

DBCC execution completed. If DBCC printed error messages, contact your system administrator.


QUESTION:
How do you run a query in VB to return the above results

SQL= "DBCC DBREINDEX ('pubs.dbo.authors', UPKCL_auidind, 0)"

conn.Execute SQL, lRet  
' Returns a -1

rs.Open SQL, conn, adOpenForwardOnly, adLockReadOnly
' Does not return anything




0
Comment
Question by:PhilChapmanJr
  • 2
3 Comments
 
LVL 29

Expert Comment

by:Nightman
ID: 17988897
I'm not sure about the return value, but try this:

SQL= "DBCC DBREINDEX ('pubs.dbo.authors', UPKCL_auidind, 0) WITH TABLERESULTS "
rs.Open SQL, conn, adOpenForwardOnly, adLockReadOnly

0
 
LVL 2

Author Comment

by:PhilChapmanJr
ID: 17989042
adding WITH TABLERESULTS  to the query does not return anything when
rs.Open SQL, conn, adOpenForwardOnly, adLockReadOnly
is run
0
 
LVL 29

Accepted Solution

by:
Nightman earned 500 total points
ID: 17989732
It appears that DBCC REINDEX does not output anything but messages (won't even output WITH TABLERESULTS). Not sure that you can do this from ADO. It might be worth looking at using the SQLDMO object - I'm pretty sure that would be able to provide the results that you are looking for.
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now