Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 

Archives: December 2010

Script Drop all tables of a database

Hi people, following a script that deletes all tables in a database. Enjoy.

 

SET NOCOUNT ON;
DECLARE @Tabela TABLE
(    Seq INT,
    Id INT,
    Name sysname);
DECLARE @Loop INT, @Qt INT;

 

-- While there ForeignKey exclude objects that are not referenced recursively

WHILE (SELECT COUNT(*) FROM… Read more

0 comments, 1,125 reads

Posted in Adeilson Brito on 27 December 2010

Grant permission to the profile

The Profiler is a powerful tool available to the dba, but it can also be very useful for system developers. Of course I'm thinking about development environments (production never). Thus, the profiler can help developers monitor the queries and stored procedures developed in the applications.

 

Follow the instruction to… Read more

0 comments, 435 reads

Posted in Adeilson Brito on 18 December 2010

Last restart of SQL Server

Occasionally I need to see what the date of last restart of SQL Server. The old method isto check the creation date of tempdb database. However, in SQL 2008 we have a DMV that can be used for this purpose: sys.dm_os_sys_info. Here's how:

 

1) Searching creation of tempdb

SELECT… Read more

1 comments, 497 reads

Posted in Adeilson Brito on 17 December 2010

Number of sessions per database

Sometimes when we need to do some maintenance on a SQL server, you need to verify which users are connected or which databases are being used. A quick and easy wayto check the server utilization is simply to identify which databases are being accessedat that time. Thus, I present two… Read more

1 comments, 492 reads

Posted in Adeilson Brito on 16 December 2010