Showing posts with label written. Show all posts
Showing posts with label written. Show all posts

Monday, March 19, 2012

Located databases no longer used.

I’m looking to locate databases that have not been written to or accessed for
a specified period of time; we are looking to locate databases that are not
used anymore and clean house. Is there a system table or stored procedure to
access this information? Thank you in advance for you assistance.
Pauly C
No there is not. Your best bet is to run a continuous trace filtered on the
particular db(s) and see if anything accesses them.
Andrew J. Kelly SQL MVP
"Pauly C" <paulysc@.optonline.net> wrote in message
news:04BD4AED-F586-4686-ADBB-0AD86A4EEF90@.microsoft.com...
> I'm looking to locate databases that have not been written to or accessed
> for
> a specified period of time; we are looking to locate databases that are
> not
> used anymore and clean house. Is there a system table or stored procedure
> to
> access this information? Thank you in advance for you assistance.
> Pauly C
>
|||Bummer, Thanks Andy. Tony B say's hello.
Pauly C
"Andrew J. Kelly" wrote:

> No there is not. Your best bet is to run a continuous trace filtered on the
> particular db(s) and see if anything accesses them.
> --
> Andrew J. Kelly SQL MVP
>
> "Pauly C" <paulysc@.optonline.net> wrote in message
> news:04BD4AED-F586-4686-ADBB-0AD86A4EEF90@.microsoft.com...
>
>
|||Didn't even realize that was you<g>. Unfortunately the answer is still
no<g>... Everyone wants that feature though.
Andrew J. Kelly SQL MVP
"Pauly C" <paulysc@.optonline.net> wrote in message
news:A5BDC793-6A72-4F0B-9891-025DC99D927C@.microsoft.com...[vbcol=seagreen]
> Bummer, Thanks Andy. Tony B say's hello.
> Pauly C
> "Andrew J. Kelly" wrote:

Wednesday, March 7, 2012

Local or global variable in an interaction session of the SQL analyzer

Hi,

I am new to SQL. Please bear with me and allow me to ask a dumb
question.

I am debugging a stored procedure (written in Trans-SQL), and I found
that the SQL analyzer that I use doesn't have a debugger. All I can
do it is execute a block of code and see what is going on in an
interaction seesion of the SQL analyzer. I would need to declare some
variable to hold values of the previous query in the interactive
session.

I understand that this can be easily done in a stored procedure via
the Declare command (e.g., Delcare @.order_no int). Is similar
functionality exists in an interaction session of the SQL analyzer?
If so, what is the command. Please advise.

Thank you very much for the help.

AlexAlex Cicco (lluum@.yahoo.com) writes:
> I am debugging a stored procedure (written in Trans-SQL), and I found
> that the SQL analyzer that I use doesn't have a debugger. All I can
> do it is execute a block of code and see what is going on in an
> interaction seesion of the SQL analyzer. I would need to declare some
> variable to hold values of the previous query in the interactive
> session.

I suppose that with SQL Analyzer you refer to Query Analyzer. If you are
using QA, you do indeed have an access to a debugger. Press F8 to get an
Object Browser Window, and then find the procedure. Right-click and at
the bottom of the context menu, voil!

> I understand that this can be easily done in a stored procedure via
> the Declare command (e.g., Delcare @.order_no int). Is similar
> functionality exists in an interaction session of the SQL analyzer?
> If so, what is the command. Please advise.

The same. For instance:

DECLARE @.x datetime
SET @.x = getdate()
SELECT @.x

--
Erland Sommarskog, SQL Server MVP, sommar@.algonet.se

Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techin.../2000/books.asp