473,806 Members | 2,697 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Truncate Database Statement help


Hello,

I hope you can help me.
We have a SQL Server 2000 database at work, (which works with a VB6
frontend) which grew to a considerable size, so one of my past colleagues
sent me this truncate statement to use on the database.
I ran it like this, and all appeared to be well, it shrank the database,
Shortly afterwards, after I ran this I noticed something not quite right.
for example, one of the tables we keep is a User_Admin table which has 50
records in there, when I accessed this using the frontend it only showed 1
record, and this happened with every table in the database accessed by the
frontend.

The data in the tables is still there, but only shows one record through the
frontend.
Can anyone help me, and check this statement I ran, as its weird that all
this happened after I ran this statement.

Thanks,

Jayne Heger

sp_dboption PBTDEV,'trunc. log on chkpt.', true
checkpoint
--sp_dboption sadev,'trunc. log on chkpt.', false
sp_dboption PBTDEV,'autoshr ink', true
--sp_dboption sadev,'autoshri nk', false

DBCC SHRINKDATABASE (PBTDEV, NOTRUNCATE)
Jul 23 '05 #1
2 2363
Hi

It is unlikely that your error is caused by this, although you may want to
run DBCC CHECKDB on the database. If you know the statement that you are
running (or use profiler to get it) you may find that you have deleted some
data that it is dependent on to get the expected results.

John

"Little PussyCat" <SP******@NOSPA M.com> wrote in message
news:f9******** ****@tiger.sphy nx...

Hello,

I hope you can help me.
We have a SQL Server 2000 database at work, (which works with a VB6
frontend) which grew to a considerable size, so one of my past colleagues
sent me this truncate statement to use on the database.
I ran it like this, and all appeared to be well, it shrank the database,
Shortly afterwards, after I ran this I noticed something not quite right.
for example, one of the tables we keep is a User_Admin table which has 50
records in there, when I accessed this using the frontend it only showed 1
record, and this happened with every table in the database accessed by the
frontend.

The data in the tables is still there, but only shows one record through
the
frontend.
Can anyone help me, and check this statement I ran, as its weird that all
this happened after I ran this statement.

Thanks,

Jayne Heger

sp_dboption PBTDEV,'trunc. log on chkpt.', true
checkpoint
--sp_dboption sadev,'trunc. log on chkpt.', false
sp_dboption PBTDEV,'autoshr ink', true
--sp_dboption sadev,'autoshri nk', false

DBCC SHRINKDATABASE (PBTDEV, NOTRUNCATE)

Jul 23 '05 #2
I agree, the error is probably coming from the application or the sp which the
application runs.

Hi

It is unlikely that your error is caused by this, although you may want to
run DBCC CHECKDB on the database. If you know the statement that you are
running (or use profiler to get it) you may find that you have deleted some
data that it is dependent on to get the expected results.

John

"Little PussyCat" <SP******@NOSPA M.com> wrote in message
news:f9******* *****@tiger.sph ynx...

Hello,

I hope you can help me.
We have a SQL Server 2000 database at work, (which works with a VB6
frontend) which grew to a considerable size, so one of my past colleagues
sent me this truncate statement to use on the database.
I ran it like this, and all appeared to be well, it shrank the database,
Shortly afterwards, after I ran this I noticed something not quite right.
for example, one of the tables we keep is a User_Admin table which has 50
records in there, when I accessed this using the frontend it only showed 1
record, and this happened with every table in the database accessed by the
frontend.

The data in the tables is still there, but only shows one record through
the
frontend.
Can anyone help me, and check this statement I ran, as its weird that all
this happened after I ran this statement.

Thanks,

Jayne Heger

sp_dboption PBTDEV,'trunc. log on chkpt.', true
checkpoint
--sp_dboption sadev,'trunc. log on chkpt.', false
sp_dboption PBTDEV,'autoshr ink', true
--sp_dboption sadev,'autoshri nk', false

DBCC SHRINKDATABASE (PBTDEV, NOTRUNCATE)




Jul 23 '05 #3

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

Similar topics

2
11422
by: NOSPAM | last post by:
Hello, I am hoping you can help me with the following problem; I need to process the following steps every couple of hours in order to keep our Sql 2000 database a small as possible (the transaction log is 5x bigger than the db). 1.back-up the entire database 2.truncate the log 3.shrink the log 4.back-up once again. As you may have determined, I am relatively new to managing a sql server database and while I have found multiple...
3
8663
by: LineVoltageHalogen | last post by:
Greeting All, I have a stored proc that dynamically truncates all the tables in my databases. I use a cursor and some dynamic sql for this: ...... create cursor Loop through sysobjects and get all table names in my database. .... exec ('truncate table ' + @TableName)
1
3043
by: New MSSQL DBA | last post by:
I have recently been assigned to take over several MSSQL environments and found some of the existing practice confusing. As most of my previous experiences are on Oracle and Unix platform so would like your inputs and comments. 1) TX log truncate: In the existing environment, there are scheduled jobs to truncate transaction log of each database in the server and shrink them back to a desired size, say 1G. These jobs are all scheduled...
5
3112
by: ronin 47th | last post by:
Hi group, In one of the books 'Gurus Guide to Transact SQL' i found this info: ------------------------------------------------------------ TRUNCATE TABLE empties a table without logging row deletions in the transaction log. It can't be used with tables referenced by FOREIGN KEY constraints, and it invalidates the transaction log for the entire database. Once the transaction log has been invalidated, it can't be backed up until the...
9
14695
by: Sumanth | last post by:
Are there any implementations of truncate in db2. Is it going to be implemented in the future? Is there an alternate way of doing a truncate of a table that has a high record count without using "load" and is fast? Thanks, Sumanth
8
8104
by: Stefan | last post by:
Hi all, two questions: - is there a way to call the INSERT-Statement from Java (JDBC). (import from file of del replace into table) - in db2 there is no truncate-statement, is it? Is in db2 something like that? Thank you for all answers Stefan
14
12299
by: Sala | last post by:
Hi I want to truncate all data in database ... pls help me how i ll truncate?
1
3329
by: hedgracer | last post by:
I would like to allow a particular user to truncate a log file in a stored procedure that the user runs every day. At this moment the only personnel that can truncate the log file are personnel with sysadmin rights. Is there any way to do this in sql server 2005 without granting this user sysadmin rights (something we REALLY don't want to do)? Thanks for all your help in advance. Dave C.
8
7718
by: ananthaisin | last post by:
How to reduce the table size for any table while using truncate or delete statements. In oracle 8i it was truncating the storage space but in 10g it is not .... I have given truncate statement in a procedure to drop the storage of a table used... when its record count exceeds 500. BEGIN i:= 0; FOR CC IN NLD LOOP
0
9719
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
10623
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10371
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
10373
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
9192
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
6877
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5546
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
5683
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3852
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.