.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

Deleting Old Accounts From An Inherited Database

Posted By:      Posted Date: October 12, 2010    Points: 0   Category :Sql Server

Dear Community,

I have inherited a website and database and after having it for a while now I realise that alot of the data within the database is redundant and that the accounts holding that data are no longer being accessed.

I would like to be able to delete any records from the account table older than 90 days and with them any associated records from all other tables.

I am new to MS SQL databases and have only been able to get as far as deleted records from the account table based on the lastlogin field.

Any help on coding the SQL statement for this delete would be very much appreciated.

If possible I would like to be able to run this automatically every month as a stored procedure, again I know very little about these but belive something of this nature is possible.

A full database diagram can be seen here : http://www.twfarmreport.com/full-database-diagram.jpg

Kind Regards


View Complete Post

More Related Resource Links

Internal server error after deleting old encryption keys after a database upgrade.



We are in the process of upgrading our current environment from sql server 2005 to 2008R2. Everything goes fine except for SSRS.I have SSRS 2008R2 installed on a seperate machine and it works. We can see the report manager etc. except it's empty of course. I then backup the ReportingServices and ReportingServicesTempDB and transfer them to the new machine. I restore the database and it gets upgraded automatically, no problems there.

Next I go to the configuration manager and change the database SSRS needs to use to the restored DB. At that point I will restore the old encryption keys belonging to that database and as a result I now have 2 servers in my scale out deployment. Seeing as we only need Standard SSRS we get an error saying that Scale out deployment is not supported in this edition(standard) of SSRS.

So what i need to do is delete the source database encryption key. So my name server is named ServerA and my old one is ServerB. I use the rskeymgmt tool to list and delete the old encryption key(ServerB). This way I end up with only 1 server in my instance.

Now when i try to go to the report manager i get the error "An internal error occurred on the report server. See logs for more info". But when i go to my logs it just shows the same message that an error occurred but it doesn't tell me what went wrong.

These a

How can I replace domain user accounts with a general database account?


How can I replace domain user accounts with a general database account?


Need to Remove Event Log Error after deleting a database sharepoint 2010


I deleted a couple of databases  fron SQL after recreating  the service application. I am getting event log errors  ID 3760 that these db's are unable to be located.

How do I remove the trigger that is making this error apear?

I have looked all through CA but unable to figuer it out.

Managing user accounts in SQL database for form based authentication


Hi everyone

I have just configured form based authentication using a SQL database created using aspnet_regsql.exe.
Does anyone know of an good solutions that my customer can use to manage it, add users, delete user etc


Multiple database support with Entity Framework

One of the features introduced in Entity Framework is being database independent. Which mean each database provider can support Entity Framework by implementing its provider.

This feature allows you build applications independent from the underplaying database provider. In this post I'm going to show how to build an application that support multiple databases using same conceptual model made by Entity Framework.

Export Visio Database Table Names to Excel

If you use the Enterprise Architect edition of Microsoft Visio for data modeling regularly, then there is a good chance that at some point you've wanted to export just the table names into Excel. You might want to do this to map logical ERD entities to physical data model tables, track project status by entity, or track overlap between database versions.

MS SQL Server: Disconnect Users From Database - Kill User Session

If you ever wanted to restore your database from a SQL backup file (.bak), but there are still users connected to your database, the backup operation will fail causing the error: Exclusive access could not be obtained because the database is in use.

Publishing SQL Server Database using Publishing Wizard : Tips & Tricks

We can use SQL Server Publishing Wizard to deploy our local Database to remote hosting server/production server.This feature is available in SQL Server 2008/VWD 2008.

Below is the complete step by step guide of this process.

Adding Rows in GridView without using a Database

This article describes on how to add rows in GridView without using a database. Basically the GridView will be populated with data based on the values entered in the TextBox on Button Click and retain the GridView data on post back.

Adding Multiple Columns and Rows in GridView without using a Database

This article describes on how to add multiple columns and rows in GridView without using a database. Basically the GridView will be populated with data based on the values entered in each TextBoxes on Button Click and retain the GridView data on post back.

ASP.NET Database Tutorial

This tutorial will show you how to display data using the .NET GridView Control, ASP.NET 2.0 and VB.NET

The GridView control is a powerful tool and is simple to implement.

First, you will need to import the System.Data.SqlClient namespace.

Connestion string create any database server

This links important to how to create connection string to any data base sever.

SQL Server Database Transaction

A transaction is a group of SQL commands executed together as a single component of work to be accomplished. If all of these commands succeed, then a transaction is committed - the changes to the data are made final. If any of the commands within a transaction fail, then the entire transaction is cancelled, or in SQL Server terms, the transaction will be rolled back.

Transactions are one of the things that keep your data safe, but they're not necessarily easy to understand. Here's some help:

Database Export Wizard for ASP.net and SQL Server

A step wizard for ASP.net to export database objects to CSV, TXT, HTML, XML, or SQL. it guides users through a few simple steps to choose a database object (table, view, or query), select columns, and export the data in any of the standard formats CSV, HTML, XML, or SQL.

Adding Client-Side Confirmation When Deleting

The JavaScript confirm(string) function displays its string input parameter as the text inside a modal dialog box that comes equipped with two buttons - OK and Cancel (see Figure 1). The confirm(string) function returns a Boolean value depending on what button is clicked (true, if the user clicks OK, and false if they click Cancel).

Reading and Writing Images From a Windows Mobile Database using UltraLite 10(C#)

Periodically I get a request for information on how to read and write binary data to a database running on Windows Mobile. If you search the Internet you can typically find examples that are available on Windows Desktops or allow you to read and write to a local file system. The problem is that it can take a bit of work to get this code to work on Windows Mobile accessing a database.

Ultimately you might be asking, why would I want to store and image in a database? Well in an environment where you synchronizing data between a local mobile database and a consolidated (central) database this can be extremely useful. Imagine if an insurance adjuster went to an accident scene, took a picture of a damaged car, loaded it into his Windows Mobile database and then replicated that image up to the Insurance headquarters for approval. All of this could be done in a very short period of time when using images in the database. Another good example might be a doctor who was waiting for a patient chart to become available. If you could store the image in a database this chart could be sent down to the doctor's device once it became available.

For this article I am not going to get into how to synchronize the images to and from a remote and central database as this is typically fairly straightforward when using a data synchronization technologies like MobiLink

Store and Display Images from MS Access Database Using C#

There is only the difference of coding syntax to stream the binary data of image content type to upload it into MS Access Database using C#/VB in ASP.Net 2.0

Namespaces required:-
using System.Data.OleDb;

OleDb is used to connect the web site forms with MS Access Database using Microsoft.Jet.OLEDB.4.0
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend