Wednesday, March 7, 2012

Newbie-How to tell when Database last used

I Inherited a SQL 2000 Server with some databases I think are no longer used.
I'm not sure on some of them what apps may be using them. How can I tell
when a database or any of its tables were last used? I don't really care
what the specific transactions were, just when it was touched. There are
database maint jobs backing up the databases. Does this imply that the
datestamps of the files change when they are backed up, and therefore not a
good indication of when they were last used?
Thanks.
"Coop" <Coop@.discussions.microsoft.com> wrote in message
news:33770A94-B003-400A-88F6-9DE689625A91@.microsoft.com...
>I Inherited a SQL 2000 Server with some databases I think are no longer
>used.
> I'm not sure on some of them what apps may be using them. How can I tell
> when a database or any of its tables were last used? I don't really care
> what the specific transactions were, just when it was touched. There are
> database maint jobs backing up the databases. Does this imply that the
> datestamps of the files change when they are backed up, and therefore not
> a
> good indication of when they were last used?
> Thanks.
There's no easy way to do this.
The timestamp on the file for example only changes when the database is
opened or the file size is changed.
You can setup a profiler to watch the database.
Or simply detach it and see who squawks first.
Greg Moore
SQL Server DBA Consulting Remote and Onsite available!
Email: sql (at) greenms.com http://www.greenms.com/sqlserver.html
|||Greg D. Moore (Strider) wrote:
> "Coop" <Coop@.discussions.microsoft.com> wrote in message
> news:33770A94-B003-400A-88F6-9DE689625A91@.microsoft.com...
> There's no easy way to do this.
> The timestamp on the file for example only changes when the database is
> opened or the file size is changed.
> You can setup a profiler to watch the database.
> Or simply detach it and see who squawks first.
>
Taking the DB offline may be simplier...

Newbie-How to tell when Database last used

I Inherited a SQL 2000 Server with some databases I think are no longer used.
I'm not sure on some of them what apps may be using them. How can I tell
when a database or any of its tables were last used? I don't really care
what the specific transactions were, just when it was touched. There are
database maint jobs backing up the databases. Does this imply that the
datestamps of the files change when they are backed up, and therefore not a
good indication of when they were last used?
Thanks."Coop" <Coop@.discussions.microsoft.com> wrote in message
news:33770A94-B003-400A-88F6-9DE689625A91@.microsoft.com...
>I Inherited a SQL 2000 Server with some databases I think are no longer
>used.
> I'm not sure on some of them what apps may be using them. How can I tell
> when a database or any of its tables were last used? I don't really care
> what the specific transactions were, just when it was touched. There are
> database maint jobs backing up the databases. Does this imply that the
> datestamps of the files change when they are backed up, and therefore not
> a
> good indication of when they were last used?
> Thanks.
There's no easy way to do this.
The timestamp on the file for example only changes when the database is
opened or the file size is changed.
You can setup a profiler to watch the database.
Or simply detach it and see who squawks first.
Greg Moore
SQL Server DBA Consulting Remote and Onsite available!
Email: sql (at) greenms.com http://www.greenms.com/sqlserver.html|||Greg D. Moore (Strider) wrote:
> "Coop" <Coop@.discussions.microsoft.com> wrote in message
> news:33770A94-B003-400A-88F6-9DE689625A91@.microsoft.com...
>> I Inherited a SQL 2000 Server with some databases I think are no longer
>> used.
>> I'm not sure on some of them what apps may be using them. How can I tell
>> when a database or any of its tables were last used? I don't really care
>> what the specific transactions were, just when it was touched. There are
>> database maint jobs backing up the databases. Does this imply that the
>> datestamps of the files change when they are backed up, and therefore not
>> a
>> good indication of when they were last used?
>> Thanks.
> There's no easy way to do this.
> The timestamp on the file for example only changes when the database is
> opened or the file size is changed.
> You can setup a profiler to watch the database.
> Or simply detach it and see who squawks first.
>
Taking the DB offline may be simplier...

Newbie-How to tell when Database last used

I Inherited a SQL 2000 Server with some databases I think are no longer used
.
I'm not sure on some of them what apps may be using them. How can I tell
when a database or any of its tables were last used? I don't really care
what the specific transactions were, just when it was touched. There are
database maint jobs backing up the databases. Does this imply that the
datestamps of the files change when they are backed up, and therefore not a
good indication of when they were last used?
Thanks."Coop" <Coop@.discussions.microsoft.com> wrote in message
news:33770A94-B003-400A-88F6-9DE689625A91@.microsoft.com...
>I Inherited a SQL 2000 Server with some databases I think are no longer
>used.
> I'm not sure on some of them what apps may be using them. How can I tell
> when a database or any of its tables were last used? I don't really care
> what the specific transactions were, just when it was touched. There are
> database maint jobs backing up the databases. Does this imply that the
> datestamps of the files change when they are backed up, and therefore not
> a
> good indication of when they were last used?
> Thanks.
There's no easy way to do this.
The timestamp on the file for example only changes when the database is
opened or the file size is changed.
You can setup a profiler to watch the database.
Or simply detach it and see who squawks first.
Greg Moore
SQL Server DBA Consulting Remote and Onsite available!
Email: sql (at) greenms.com http://www.greenms.com/sqlserver.html|||Greg D. Moore (Strider) wrote:
> "Coop" <Coop@.discussions.microsoft.com> wrote in message
> news:33770A94-B003-400A-88F6-9DE689625A91@.microsoft.com...
> There's no easy way to do this.
> The timestamp on the file for example only changes when the database is
> opened or the file size is changed.
> You can setup a profiler to watch the database.
> Or simply detach it and see who squawks first.
>
Taking the DB offline may be simplier...

Newbie-Grand Total

This should be easy right? just need a total of the Tier_cnt. Should be 80 but I want the server to tell me.

Thanks

Select tier, count(tier) as tier_cnt
from leads
group by tier

tier tier_cnt
---------------- ----
NULL 0
5
Other 35
Tier 1 25
Tier 2 11
Tier 3 4

Tier_tot
---
????Add the COMPUTE function to your SELECT

Select tier, count(tier) as tier_cnt
from leads
group by tier
compute sum(count(tier))|||Muito Gracias

Exactly what I needed.

newbie-Any major differences?

Hi,
I would like to know from any serious readers of the below
books.
1] Microsoft SQL Server 7.0 Dba Survival Guide by Mark
Spenik
2] Microsoft SQL Server 2000 Dba Survival Guide by Mark
Spenik
Do you find any MAJOR differences in the content?
I have the availability of book v 7.0 ( republished for
Asia) but v2000 not yet republished.
If there are any major changes I may have to order for the
original publication.
Kindly point-out the differences if possible.
Regards
Chip| I would like to know from any serious readers of the below
| books.
|
| 1] Microsoft SQL Server 7.0 Dba Survival Guide by Mark
| Spenik
|
| 2] Microsoft SQL Server 2000 Dba Survival Guide by Mark
| Spenik
|
| Do you find any MAJOR differences in the content?
|
| I have the availability of book v 7.0 ( republished for
| Asia) but v2000 not yet republished.
|
| If there are any major changes I may have to order for the
| original publication.
|
| Kindly point-out the differences if possible.
|
| Regards
--
I have never read these books but I would postulate that the major
differences in those two books are the difference in features between SQL
7.0 and SQL 2000.
If you have to administer both versions of SQL Server, I would advise
keeping a copy of both editions.
Regards,
--
Eric Cárdenas
SQL Server support

Newbie?: Can This Be Done?- If so please direct

Hello NG
I have been working with Access for a Long Time - Am just now starting
to get my feet wet with SQL Server 2000 - We have a production database that
we have moved the tables to SQLServer and I have been creating stored
procedures to replicate some of the processes done on the access side - the
server does process extremely faster than access - Here is my problem I am
currently pulling info from SQL SERVER to Access once a w for wly
stats I want to create a stored procedure to process the wly stats and
push them to an access table upon request - we have multiple warehouses and
i would like to have the process coded once in sql and dump to the access
table based off a warehouse variable passed to the stored procedure - Can
SQLServer from a stored procedure export a recordset into a varible defined
Access Table?
TIAFAH
RandyIt sounds like DTS is what you're looking for. I don't know that I
would recommend this approach to an experienced SQL Server developer
because of its limitations, but in what you're asking for, it seems
ideal. Open Enterprise Manager, right-click your database, select
"Export Data" (it might be under a submenu), follow the wizard. I'm
pretty sure you can specify a stored procedure for the source. If I
remember correctly, you may also schedule the package to run at
intervals.
-Alan
Randy wrote:
> Hello NG
> I have been working with Access for a Long Time - Am just now starting
> to get my feet wet with SQL Server 2000 - We have a production database th
at
> we have moved the tables to SQLServer and I have been creating stored
> procedures to replicate some of the processes done on the access side - th
e
> server does process extremely faster than access - Here is my problem I am
> currently pulling info from SQL SERVER to Access once a w for wly
> stats I want to create a stored procedure to process the wly stats and
> push them to an access table upon request - we have multiple warehouses an
d
> i would like to have the process coded once in sql and dump to the access
> table based off a warehouse variable passed to the stored procedure - Can
> SQLServer from a stored procedure export a recordset into a varible define
d
> Access Table?
> TIAFAH
> Randy

Newbie:Why this Select doesn't work ?

On ASP.NET 2.0, VB, I try to let user input data on TxtBox1.Text. Then I
would like to go to SQL database named PUBS and compare the "TxtBox1.Text"
against the table "job_id". If the results match, I return on the screen
"Information matched. Your password will be reset".
First, how can I establish the connection to the "pubs" and retrieve such
information ? The code below return error "job_id" not declared. Do I really
have to declare the "job_id" or something else I did is not working ?
rtial Class Default_aspx
Sub btnDefault_Click(ByVal sender As Object, ByVal e As
System.EventArgs)
Dim sConnect As String = ConfigurationSettings.ConnectionStrings_
("pubs").ConnectionString
Dim sSQL As String = "SELECT Employee, " _
& "WHERE job_id = TxtBox1.Text"
End Sub
End Class> Dim sSQL As String = "SELECT Employee, " _
> & "WHERE job_id = TxtBox1.Text"
Your query string should be "Select * from Employee where job_id = '" &
TxtBox1.Text & "'"
"Mr. Magoo" <maggo@.nospasm.com> wrote in message
news:ub3B3mUJFHA.1176@.TK2MSFTNGP12.phx.gbl...
> On ASP.NET 2.0, VB, I try to let user input data on TxtBox1.Text. Then I
> would like to go to SQL database named PUBS and compare the
> "TxtBox1.Text" against the table "job_id". If the results match, I return
> on the screen "Information matched. Your password will be reset".
> First, how can I establish the connection to the "pubs" and retrieve such
> information ? The code below return error "job_id" not declared. Do I
> really have to declare the "job_id" or something else I did is not working
> ?
> rtial Class Default_aspx
> Sub btnDefault_Click(ByVal sender As Object, ByVal e As
> System.EventArgs)
> Dim sConnect As String = ConfigurationSettings.ConnectionStrings_
> ("pubs").ConnectionString
> Dim sSQL As String = "SELECT Employee, " _
> & "WHERE job_id = TxtBox1.Text"
> End Sub
> End Class
>|||There is no From clause in this select statement. You need to specify that.
Dim sSQL As String = "SELECT Employee From Pubs " _
& "WHERE job_id = " & TxtBox1.Text
Thanks
Baiju
"Mr. Magoo" <maggo@.nospasm.com> wrote in message
news:ub3B3mUJFHA.1176@.TK2MSFTNGP12.phx.gbl...
> On ASP.NET 2.0, VB, I try to let user input data on TxtBox1.Text. Then I
> would like to go to SQL database named PUBS and compare the
"TxtBox1.Text"
> against the table "job_id". If the results match, I return on the screen
> "Information matched. Your password will be reset".
> First, how can I establish the connection to the "pubs" and retrieve such
> information ? The code below return error "job_id" not declared. Do I
really
> have to declare the "job_id" or something else I did is not working ?
> rtial Class Default_aspx
> Sub btnDefault_Click(ByVal sender As Object, ByVal e As
> System.EventArgs)
> Dim sConnect As String = ConfigurationSettings.ConnectionStrings_
> ("pubs").ConnectionString
> Dim sSQL As String = "SELECT Employee, " _
> & "WHERE job_id = TxtBox1.Text"
> End Sub
> End Class
>|||You guys are rocking !!
"Baiju" <baiju@.indus-systems.com> wrote in message
news:eBE94EVJFHA.2640@.TK2MSFTNGP09.phx.gbl...
> There is no From clause in this select statement. You need to specify
> that.
> Dim sSQL As String = "SELECT Employee From Pubs " _
> & "WHERE job_id = " & TxtBox1.Text
> Thanks
> Baiju
> "Mr. Magoo" <maggo@.nospasm.com> wrote in message
> news:ub3B3mUJFHA.1176@.TK2MSFTNGP12.phx.gbl...
> "TxtBox1.Text"
> really
>