Purging A Database Data While Keeping The Structure Intact

Oct 15, 2006

Is it possible to purge all records in the database while retaining the the table structures. Even better yet, could I do it on a table by table basis?   If I simply delete all the records the identities for the tables do not revert back to 1.

View 2 Replies


ADVERTISEMENT

Keeping The Audit Info Intact.

Apr 10, 2008

Hi all

I have a stored procedures with few DML stmts inside.

I need to log the success/failure of each DML statment into seperate audit table as follows

Begin
DML Stmt1
Log sucess/failure (Insert stmt to audit table)
DML Stm2
Log sucess/failure (Insert stmt to audit table)
end

when any of the above DML stmt fails, the entire transaction is getting rolled back including the audit information.

How can i keep the audit info intact when the transaction is rolled back.

Thanks.

View 1 Replies View Related

Purging Data Off Of An MSDE Database.

Jan 17, 2007

How do I purge data off of an MSDE database. I only want to keep 6 months of data in the database. Right now I have data going back to 2004. I get errors about every 10 seconds. "Primary File Group is Full" is the error I am getting.

View 7 Replies View Related

SQL Help With Purging Old Data

Feb 28, 2007

Does anyone know how to purge old data in a MS SQL server 2000database?

View 1 Replies View Related

Purging Deleted Database Names

Jul 1, 2002

When connecting to an SQL Server (v7 in this case) the log file shows that old and deleted databases are still being opened as part of the process. Further, these db names are now reserved and cannot be reused, even thought I've deleted them.

Is there any way I can purge all traces of these deleted db names?

You might have guessed, I'm a newbie, which is why there are a few dozen deleted DBs.

Thanks for any help
Max
atomax@gmx.net

View 2 Replies View Related

Data-archiving And Purging Strategy

Mar 31, 2008



Regarding SQL Server data, I am looking to implement the beset Data-Archive and Purge policy. Normal, we do SQL Backups and keep the history for some period , for example, 8 weeks, so we can go back and restore any data point in time upto 8 month in past. and we also do Tape backups.

Question is Where can I get nice article or documentation on this to best design such policy where I make sure that I am covered for point in time recovery of database (which is sql backups) and point in time recovery in far past, say, 3 years ago using tape backups, and I need to make sure that I don't repeat the same efforsts.

Any advices or suggestion on this topic.

Thanks,

View 5 Replies View Related

Accessing Data Structure Of A MS SQL Database

Mar 19, 2008

I have written 5 content-management systems and am getting a little bored writing a lot of the same functionality and tweaking it for different datamodels.  Is there a way within .NET to have visibility of a database's structure (ie, data type, column names, foreign keys etc)?  I'd like to write up a dynamically generated form for any given table, displaying appropriate form controls based on data type and foreign keys.

View 7 Replies View Related

Copying Data And Structure From One Database To Another

Jul 23, 2005

Hi all!I have an application that needs to copy the database structure fromone database to another without using the "Generate SQL Script"function in Enterprise Manager. I'd like to do this from within astored procedure. Can someone recommend the best approach for this?I've seen references to using SQL-DMO from a stored procedure using thesp_OA* procs in other postings to this group but was wondering if therewas an easier way? Can I use bcp and then use xp_cmdshell from withinmy stored procedure? It's not clear to me from the documentationwhether bcp copies both structure and data or just data? Is there abetter way?Thanks in advance for any help!Karen

View 1 Replies View Related

Copy Just The Database Structure Not The Data

Feb 19, 2007

I have been working on my windows app, using SQL Server 2005 (& C#) but I now have loads of junk data, so I want to copy the structure without any data to a new set of files that can become the production version.

I assume I can use backup and restore in future when I want a copy of my production data to use for future testing.

How would I take just one table from my test database and add it to my production database without retyping the design?

Apart from the size limitation is there any advantage in buying a version of SQL Server over using the Express edition?

View 1 Replies View Related

Copy Database Structure But Not The Data

Feb 13, 2008

I'm looking to create a new version of a database but with completely reloaded data - so I want to retain the database structure but none of the data.

Is there an easy way (read: without a DBA on staff) to copy an existing database structure - preferably with views and stored procedures - and not take the data along for the ride?

Thanks in advance for suggestions...!

View 7 Replies View Related

How To Copy Database Structure From One Db To Another W/o Affecting Data

Jul 23, 2005

Is there a way to copy the structure from one database to anotherwithout affecting the actual data?For example, I added new fields and stored procedures to a db in mydevelopment environment. There are a lot of them.I now want to make the same changes to my production environment db butdon't want to affect the data. Only the fields, stored procs &constraints and stuff pertaining to the structure of the db should bechanged.Does anyone know of a program that can do this or can this be done inMS SQL Enterprise Manager.Any help would be appreciated.7078895

View 2 Replies View Related

SQL Server 2012 :: Purging Data From Master And 5 Child Tables

Jul 5, 2014

I have 6 tables which are very huge in row count and records needs to deleted which are older than 8 days.

Little info: Every day, 300 Million records are inserted in below 7 tables. we should maintain only 8 days worth of data in below tables. How to implement Purge script which can delete records in all tables in the same time and with optimized parallelism.

Master table which has [ID],[Timestamp]
Table Name: Sample - 2,578,106

Child tables: Foreign key [ID] is common for all the tables. There is no timestamp column in child table. So the records needs to deleted based on Min(ID) from Sample

dbo.ConnectionDB - 1,147,578,048
dbo.ConnectionSS - 876,458,321
dbo.ConnectionRT - 118,133,857
dbo.ConnectionSample - 100,038,535
dbo.Command - 100,032,235

View 9 Replies View Related

How To Prevent System Administrator To View And Edit A Database Structure And Data

Dec 26, 2007

I represent a software development house and we have developed a client server system based on SQL Server. Most of our customers have already purchased Enterprise License of SQL Server, therefore they own the SA Login and Password. We are bound to attach our Database with their Server on their machine.

My question is how can we stop a System Administrator of SQL Server to view our Database Structure, Queries, Data installed on their SQL Server on their machine.

Our database structure is a trade secret and we cant reveal the structure to the client.

please answer this question by email to me at farhandotcom@gmail.com

Thanks & Regards
Farhan

View 1 Replies View Related

Truncate All Tables In DB With RI Intact

Jun 22, 2004

Anyone?

I tried the following code...thought I could trap the RI Error and move on...

It raises all the way out though....

Server: Msg 4712, Level 16, State 1, Line 1
Cannot truncate table 'myTable99' because it is being referenced by a FOREIGN KEY constraint.

I thought you could trap it this way...


CREATE TABLE myTable99(Col1 int PRIMARY KEY)
GO
CREATE TABLE myTable00(Col1 int, Col2 int, PRIMARY KEY(Col1,Col2), FOREIGN KEY (Col1) REFERENCES myTable99(Col1))
GO

INSERT INTO myTable99(Col1) SELECT 1
INSERT INTO myTable00(Col1, Col2) SELECT 1,2
GO

CREATE PROC myDynamicSQL99 @sql varchar(8000) AS EXEC(@sql)
GO

DECLARE @error int, @TABLE_NAME sysname, @sql varchar(8000), @x int, @rc int
SELECT @error = 0, @x = 0

DoItAgain:

DECLARE myCursor99 CURSOR
FOR
SELECT TABLE_NAME
FROM INFORMATION_SCHEMA.Tables
WHERE TABLE_NAME LIKE 'myTable%'
ORDER BY TABLE_NAME DESC

OPEN myCursor99

FETCH NEXT FROM myCursor99 INTO @TABLE_NAME

WHILE @@FETCH_STATUS = 0
BEGIN
SELECT @SQL = 'TRUNCATE TABLE ' + @TABLE_NAME
SELECT @SQL
EXEC @rc = myDynamicSQL99 @SQL
SELECT @Error = @@Error
SELECT 'Error Code: ' + CONVERT(varchar(15),@Error) + ' @rc: '+ CONVERT(varchar(15),@rc)
IF @Error <> 0
SELECT @x = @x + 1
FETCH NEXT FROM myCursor99 INTO @TABLE_NAME
END

CLOSE myCursor99
DEALLOCATE myCursor99

IF @x <> 0
BEGIN
SELECT @Error = 0
GOTO DoItAgain
END
GO

DROP PROC myDynamicSQL99
DROP TABLE myTable00
DROP TABLE myTable99
GO

View 14 Replies View Related

Keeping Database As Small As Possible ?

Oct 16, 2006

Hello everyone,



I have a winform application with C# front end and sql express 05 backend.

In this database i have a table that holds manufacturer provided pricing and the manufacturers we work with update pricing constantly.

We have one table called "manufacturerpricing" which we are constantly inserting and deleting pricing records to/from to keep manufacturer pricing up to date. We may insert and delete as many as 2,000,000 records per month into this table.

This works perfectly fine and we have no problems here at all.

But with that being said, I am worried about the size of the database growing out of control due to temporary space etc. The database just keeps getting bigger and bigger.

How do I run some maintenance to keep the database size under control.

I would like to run this automatically from the C# front end so if ther is a stored proc I can call or an C# assembly I can reference that would be ideal.

Any help is greatly appreciated.

View 3 Replies View Related

Keeping Dirty Data

Jan 24, 2008

This may be more of a data design question and not an ssis question, but figured folks here could have a good idea.....the organization I'm in has the business need of collecting data from outside organizations and tracking what data is bad and what data is good. When I say bad data I mean everything from things outside of range to absolute *** - characters in integer columns, integers in character columns, special characters, etc. The data comes in in the form of flat file so it's a free for all until it hits ssis & the db engine.

Eventually of course they work to get the data corrected at the source & resubmitted but in the meantime, they have the legitimate need of not only pushing the data into the database (dirty or not), but keeping all the bad stuff. I can't in good conscience make everything a varchar to catch everything - that would go against the database gods. IMO - I still must make an integer be an integer , characters are characters, etc. But what do I do with the junk? Any thoughts?

View 4 Replies View Related

SQL 2005: Keeping Track Of Database Changes

Jul 5, 2006

I'm actually taking Microsoft's 2779 and just finished a lab where wekept track of our changes to the database.However, I'm not happy with the scripts interface because it does nottell me the chronological order of my changes to the database.Could someone share with me their technique for keeping track ofdatabase changes?I'm actually thinking a set of tables would be best, because sometimesyou want to know what database object you made a change to and othertimes you want to know when you did something...

View 2 Replies View Related

Storing Data As Varchar, But Keeping Breaks?

Jun 11, 2007

Is it possible to store data as varchar and keep line breaks, spaces, indents, and all that stuff intact?

Thanks again for all the help.

View 2 Replies View Related

How Can I Get The 'entire' Database, Structure And Data, From SQL Server 2008 To SQL Server 2005?

Jun 20, 2008

1) I can't get the 'copy database' function to work from SQL Server 2008 to SQL Server 2005. I connect ok. Everything goes to the last step and then it fails.2) I cant get a SQL server 2008 backup to restore on SQL SEerver 2005 either.
The only way I know that works is to script the creation of all tables then export and import. This does work.
How can I get the 'entire' database, structure and data, from 2008 to 2005?
ThanksSQL newbie.

View 2 Replies View Related

SQL Server 2008 :: Keeping Security On Database Restore?

Feb 17, 2015

I have a database used in SSRS in which I get a backup daily and restore it to database "DATA"

The issue I come across is SSRS has a datareader user(ssrsuser) for access to the "report store" web where users get reports

access gets erased on each restore. Can I add something to my job to restore this user after each restore or keep the settings?

declare @Bakpath varchar(80)
set @bakpath = 'C:EDataExtractedDataextract.bak'
Use Master
Alter Database [Data]
SET SINGLE_USER With ROLLBACK IMMEDIATE
RESTORE DATABASE [Data] FROM DISK = @bakpath --location of .bak file
WITH REPLACE
GO

View 5 Replies View Related

Database Mirroring, Methods For Keeping Logins Synced.

May 31, 2007

I am in the process of implementing database mirroring. I am trying to get an understanding about manageable ways of keeping sql user logins synced between instances.

I have looked at KB918992 which makes sense for the initial intallation, but what about keeping passwords synced in the long-term. I don't want to have to manually set a users password on the failover every time they change it.

How is everyone else accomplishing this using sql logins (not windows auth)? Pointers to articles and/or documentation would be great.

Thanks.

View 1 Replies View Related

Keeping Text Format After Stored In The Data Base.

Jan 14, 2004

I want the users of my site to be able to write a couple of paragraphs, save it to SQL Server and then have it read back and look the same. I don't want the users to be able to add any html to the text they submit. I just want them to be able to seperate or indent their paragraphs.

At one point, I had a textbox that saved text to the server and read it back the same way it was originally inputed. However, I can't figure our what I had done to make it work.

Any ideas?
Thanks

View 2 Replies View Related

Transact SQL :: Splitting Column Value While Keeping Existing Data

Jun 22, 2015

Currently I have a column with multiple postcodes in one value which are split with the “/” character along with the corresponding location data. What I need to do is split these postcode values into separate rows while keeping their corresponding location data.

For example
PostCode            Latitude               Longitude
66000/66100       42.696595            2.899370
20251/20270       42.196471            9.404951

Would become
PostCode            Latitude               Longitude
66000                    42.696595            2.899370
66100                    42.696595            2.899370
20251                    42.196471            9.404951
20270                    42.196471            9.404951

View 6 Replies View Related

SQL Server 2012 :: Splitting Column Value While Keeping Existing Data?

Jun 22, 2015

Currently I have a column with multiple postcodes in one value which are split with the “/” character along with the corresponding location data. What I need to do is split these postcode values into separate rows while keeping their corresponding location data.

For example:

PostCodeLatitudeLongitude
66000/6610042.6965952.899370
20251/2027042.1964719.404951

Would become

PostCodeLatitudeLongitude
6600042.6965952.899370
6610042.6965952.899370
2025142.1964719.404951
2027042.1964719.404951

how this can be done?

View 2 Replies View Related

Cache Database Structure (How To Detect If Database-design Has Changed..)

Feb 24, 2006

Hello everyone,I have a webcontrol that uses database-structures alot, it uses the system tables in SQL to read column information from tables. To ease the load of the SQL server I have a property that stores this information in a cache and everything works fine.I am doing some research to find if there are anyway to get information from the SQL server that the structure from a table has changed.I want to know if a column or table has changed any values, like datatype, name, properties, etc.Any suggestions out there ?!

View 3 Replies View Related

Copy Sqlce Database Structure To Sqlserver Database

Jan 6, 2008

Hi,
I have a complicated sql server mobile database (.sdf) and need to create a SQL SERVER database with the same tables. How can I do it without scripting the whole thing? I thought of using the views.information_schema databases, but it is still a lot of coding.

thanks

View 3 Replies View Related

Archival And Purging

Jul 17, 2004

How to implement a optimal archival and purging in MSSQL SERVER
databases

View 3 Replies View Related

Purging Old Tranlogs

Sep 23, 2005

hi !
I have a job that creates tranlog backups every 15 mins and makes a full database backup at midnight.
I want to purge the old logs after the full backup , how can I do that ?

thanks
Sami

View 2 Replies View Related

Purging TempDB

Jun 20, 2007

Hi DB Experts



I have a question on shrinking tempDB. Currently, I am using MS SQL 2005 Server, I have a software that used SQL DB but I had created a separate database to store my data. The tempDB is totally not used at all.

Problem - Whenever I export data into my created database on MS SQL server, tempDB also grew, I noticed that the files grew so large that it crashed the server. I am running 50GB free space on my drive where by the MS SQL server was installed.

Question - May I know are there any solution to shrink or freeze the growth of tempDB size?





Best regards

TEWCT

View 7 Replies View Related

Database Structure

Sep 25, 2007

Hello I am a final year student and for my final year project I have decided to try and create a price comparison website due to the fact that i feel it would be a good project to work on and develop my technical skills in C# and microsoft sql server 2005, since these are mainly the two programs I would say i have more experience with. Basically I want to create a website such as www.pricerunner.com. At this point in time i have started playing around with how i feel the database will look, in terms of tables and columns, below is what i have produced;
Company                                
 Company_ID
Company_name
ADDRESS
 Website link
 contact 
Products
Product_ID
Product_name
Product_Category
Product_Price
 
I am now stuck as how i will link each company with a product bearing in mind a company will stock different categories of products, also do you think i need any more columns in any of the above tables, as well as am i missing out on anything, I am hoping someone with more knowlegde than myself can shed some knowledge on my problem, thank you.

View 5 Replies View Related

Getting SQL Database Structure From Here To There

Aug 10, 2005

I'm sure there is a simple way to do this but I cannot think of it.I have an ASP.NET application that I am publishing to a webhost. I have chosen to use FTP to copy my files (aspx, etc.). They work as far as links etc. Now, the next step is to create my SQL database on their server as they instruct, which I have done in name only. (Oh, if it makes a difference, I access the hosting service using Plesk control panel.) Is there any simple way to get my database structure from my PC to the host server? All responses welcome. Thanks.

View 5 Replies View Related

Database Structure

Oct 9, 2001

Hi All,
I need to get some info on how I can get the script of the entire database stucture. I need to write a procedure to do this. I know in SQL Server I could get the script in a mouse click. But I need to write a procedure to do the task. Is there a package in SQL Server that I could use to accomplish this task?
Any thoughts will be of help.
Thanks in advance.
sj

View 1 Replies View Related

New Database Structure

Sep 2, 1999

I am very new to SQL server, and am completely stumped here. I need to transfer the data from an old database to a new one (both SQL Server 6.5 DBs.) The only problem is that the database has been restructured, and I can't for the life of me figure out how to get the data imported. I am working on manually making all of the structure changes, but there must be a better way. Any ideas? Thank you SO much!

Jeff

View 1 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved