Showing posts with label figure. Show all posts
Showing posts with label figure. Show all posts

Friday, March 23, 2012

last time someone connected to a database

Hello all,

Is there a way to figure out when was the last time someone connected to
a database? SQL 2000 environment.

Thanks,
Raziq.

*** Sent via Developersdex http://www.developersdex.com ***Raziq Shekha (raziq_shekha@.anadarko.com) writes:
> Is there a way to figure out when was the last time someone connected to
> a database? SQL 2000 environment.

You would have to set up a trace with Profiler or the sp_trace_xxx routines
to track this.

--
Erland Sommarskog, SQL Server MVP, esquel@.sommarskog.se

Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techin.../2000/books.asp|||Thanks Erland. But setting up a trace will only tell me when someone
logs on to a database in the future. I don't think it will tell me
whether someone logged on to a database last week.

What I am trying to do is to determine whether there are any databases
to which no one has connected to in a long time. And if that is the
case, I can try and get rid of those databases.

Thanks,
Raziq.

*** Sent via Developersdex http://www.developersdex.com ***|||Raziq Shekha (raziq_shekha@.anadarko.com) writes:
> Thanks Erland. But setting up a trace will only tell me when someone
> logs on to a database in the future. I don't think it will tell me
> whether someone logged on to a database last week.

Correct. The information you are asking for, is not available unless
you collect it.

> What I am trying to do is to determine whether there are any databases
> to which no one has connected to in a long time. And if that is the
> case, I can try and get rid of those databases.

Be aggressive! Find the most suspicious ones, set them offline, and
see if someone screams!

--
Erland Sommarskog, SQL Server MVP, esquel@.sommarskog.se

Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techin.../2000/books.asp|||LOL. I like the way you think :)

Thanks,
Raziq.

*** Sent via Developersdex http://www.developersdex.com ***|||LOL. I like the way you think :)

Thanks,
Raziq.

*** Sent via Developersdex http://www.developersdex.com ***

Wednesday, March 21, 2012

last row

How do I return the last row in a Sql table? I know it must be easy that's why i can't figure it outSELECT TOP 1 * FROM [mytable] ORDER BY [mycolumn] DESC

Last record in each group

Greetings anyone -

I have been attempting to figure out - in Report Builder - how to print only the last record in each group, i.e. the last activity. I see no Last function available anywhere.

Would someone please be so kind as to advise how this can be done?

If this cannot be accomplished in Rpt Builder, it looks as if the Last function is available within Report Designer. Unfortunately, although documentation states it's available, it does not state where this function can be utilized. I'm certainly having no luck.

Help pls?

Tks & B/R

I don't know how to do that in Report Builder, but in Report Designer you can use the Last Function in any expression. In the Edit Expression dialog, click on Common Functions, and then Last to insert fhe function into the expression.