Finding Out How Many Times A Table Is Accessed

Jul 20, 2005

We have an application that accesses a particular table, but it is
never updated. Without stepping through the complex application code,
is there a method of logging when a particular table is accessed?

View 3 Replies


ADVERTISEMENT

Finding Out How Many Times A Report On RS Has Been Run

Jun 7, 2007

Is there something that I can use to track how many times a report has been accessed or run or who has run it? Is there some kind of tool out there that does this?

View 7 Replies View Related

Finding Number Of Hours Between Two Times?

Apr 24, 2014

I need to write a SQL to find number of hours between a begin time and end time. The fields are varchar. There are several date functions in sql, but I am not able to figure out how to get the hours between two times that is not in date format.

BEGIN_TIME END_TIME
0900----- 1500
1000----- 1700
1000----- 1230
0930----- 1030

View 3 Replies View Related

Table Last Accessed

Apr 16, 2008

Can i find out when a table was last accessed?

The purpose of this is to create a list of tables that could potentially be deleted. I would then prefix them with a d and the auto delete them after x number of days? or move them to a deletions database?

Just trying to automate a bit of house keeping in the active databases.

View 3 Replies View Related

Data/Table Last Accessed/Modified

Apr 28, 2004

Is anyone aware of a method of determining when a table was last modified or accessed?

Some of our databases have tables that I am sure are not being used and I would like to generate a list of tables that have not been accessed or modified for some period of time.

I looked for a system procedure but didn't see anything that satisfied my need.

Currently I rename suspect tables and wait for someone or some process to gripe, but I don't care for that method for obvious reasons.

Thanks!

View 4 Replies View Related

SQL 2012 :: Determine If A Certain Table Has Been Accessed In The Past?

Nov 4, 2015

code that I can use to determine if a certain table has been accessed in the past?

View 6 Replies View Related

SQL Server Admin 2014 :: List Of Users That Accessed A Table

Jul 22, 2015

I'm trying to find out what tables are being used in a Database.

I don't want the last User but the User and the Dates.

I have a script that return the last user but that is not going to work.

The following script returns the last user but not all users and the Login Name:

ITH LastActivity (ObjectID, LastAction) AS
(
SELECT object_id AS TableName,
last_user_seek as LastAction
FROM sys.dm_db_index_usage_stats u
WHERE database_id = db_id(db_name())

[Code] .....

View 2 Replies View Related

Transact SQL :: Avoid Same Table Multiple Times Rather Than Put Records In Single Table And Use It Throughout

Nov 19, 2015

There are 3 tables Property , PropertyExternalReference , PropertyAssesmentValuation which are common for 60 business rule

SELECT  
 PE.PropertyExternalReferenceValue  [BAReferenceNumber]
, PA.DescriptionCode
    [PSDCode]
, PV.ValuationEffectiveDate
    [EffectiveDate]
, PV.PropertyListAlterationDate
    [ListAlterationDate]

[code]....

Can we push the data for the above query in a physical table and create index to make the query fast rather than using the same set  tables multiple times 

View 11 Replies View Related

Analysis :: Hierarchy Based On Dimension Table Joined Multiple Times Against A Fact Table?

Aug 11, 2015

I am working on a model where I have a sales fact table. Each fact record has four different customer fields (ship- to, sold-to, payer, and bill-to customer). I have one customer dimension table that joins to the sales fact table four times (once for each of the customer fields above).  When viewing the data in Excel, I would like to have four hierarchies (ship -to, sold-to, payer, and bill-to customer) within Customer. 

Is there a way to build hierarchies within my Customer dimension based on the same Customer table?  What I want is to view the data in Excel and see the Customer dimension.  Within Customer, I want four hierarchies. 

View 2 Replies View Related

Alaising The Same Table Multiple Times

Oct 18, 2004

To All--

First off, I'm new to SQL Server and apologize if this is a trivial question.

What I'm trying to do is alias the same table with 2 different names so that I may join them on two different fields.

Table1
Emp_Number
Emp_Code_1
Emp_Code_2

Table2 (Contains a list of codes and their related descriptions)
Emp_Code
Long_Desc
Short_Desc

I'm trying to query Table1 for the Emp_Number but I want to get the Short_Desc from Table2 for both Emp_Code1 and Emp_Code2. I'm using Microsoft Access as the front end (using Pass Through Queries) and SQL Server on the back end.

Hope this makes sense.

C

View 1 Replies View Related

Looping Through Table To Exec An SP Many Times

Dec 31, 2006

Hi,
If i have an SP called mySP that accepts one parameter @param
If I have a table of paramaters with only one column like this:
Param1
Param2
..
ParamN

How do I do if I want to execute the SP on all the table fields:
some thing like this:
Exec my SP 'Param1'
Exec mySP 'Param2'
...
Exec mySP 'ParamN'
I want that automatically since the parameters are going to be in a table called myTblParams
Notice that I don t want to pass all the parameters to the SP just once but only one value each time I execute the SP since mySP ccepts only one parameter.

Thanks a lot for guidelines

View 8 Replies View Related

Finding Rows In One Table But Not In Another Table Based On 2 Fields

Apr 23, 2008



I have 2 tables with 2 fields in common between them. How do I get a count of rows in table 1 but not in table 2 matching those 2 fields? Thanks.

View 7 Replies View Related

Nested Joins - Joining One Table To Another Multiple Times

Jan 9, 2006

Hi,I'm having problems constructing a nested join. It's quite complex, sohere's a simplfied example of the problem. Any thoughts on what I'mdoig wrong - or if I've got the whole approach wrong are welcome.I've two tables :-one is a contact table contacting name, addresses etc. Three of thefields represent users - 'created by', 'last modified by' and 'owner'.They contain usernames - eg. JDOE, BSMITH etc.The other table contants usernames and new ID codes.What I want to do is create a new dataset by joining the contacts tablewith the user table on all three fields - so the new dataset containsthe ids for the creator, last modifier and owner.I've tried things similar to:select c.*, u1.id, u2,id, u3.idfrom contact cleft outer join users u1left outer join users u2left outer join users u3on (u3.username = c.owner)on (u2.username = c.modified)on (u1.username = c.creator )But it compains that"The column prefix 'c' does not match with a table name or alias nameused in the query."The problem is referencing c (contact) through the whole set of joins.I would like to do this in some similar format as the query is within acursor and post-processing would be very long-winded.Thanks

View 1 Replies View Related

Selecting X Records From Table N Times According To Variable Criteria?

Jul 20, 2005

Hi All,Sorry if the subject line is too obscure -- I couldn't think of a wayof describing this request.I have a table that contains approximately 1 million records.I want to be able to be able to select the top x records out of thistable matching variable criteria.Pseudo table records:custid, category, segment1,1,12,1,13,1,14,1,15,1,26,1,27,1,28,1,29,2,110,2,111,2,112,2,113,2,214,2,215,2,216,2,217,2,318,2,319,2,320,2,3So, what I'm trying to do is return a recordset, for example, thatcontains the top 2 of each variation of category and segment.ie:1,1,12,1,15,1,26,1,29,2,110,2,113,2,214,2,217,2,318,2,3The only way I can think to achieve this is in a while statement,performing individual selects against each combination, feeding thewhere criteria by variables that I automatically increment.I can't help thinking there's a much more graceful way of achievingthis?If anyone can give me any insight into this I'd be incrediblyappreciative!Many thanks in advance!Much warmth,Murray

View 1 Replies View Related

Check Sql Table Input At Certian Times And Send Email

Jan 11, 2006

I have a .net web application and need to create a program that needs to check the database every two hours and if data has not been input send the user an email message. I have heard this can be done via SQL Server - events or triggers?  Can anyone tell me where I can find example code or more information on this. Thank you in advance. 

View 2 Replies View Related

Finding The Table Name.

Dec 15, 2006

I have a script that creates these spin off tables (used for lightning fast access) on a near daily basis. But it is possible the table does not exist for that day - in which the script need to check one day back - so on and so forth until finding the most recently created table.

The script I have written fails with overflow error.
I was hoping someone could tell me the correct syntax to accomplish this and also why i recieve this overflow error...


Code:


Dim str_SQL_Asset_1
daysBack = 1
tblFound = FALSE
Dim xbl_Holdings_date
Dim xMonth
Dim xDay
xbl_Holdings_date = date()
If Len(Month(xbl_Holdings_date))=1 Then
xMonth = "0" & Month(xbl_Holdings_date)
Else
xMonth = Month(xbl_Holdings_date)
End If
If Len(Day(xbl_Holdings_date))=1 Then
xDay = "0" & Day(xbl_Holdings_date)
Else
xDay = Day(xbl_Holdings_date)
End If

DO WHILE tblFound = FALSE
xbl_Holdings_Name = "xbl_Holdings_" & Year(xbl_Holdings_date) & "_" & xMonth & "_" & xDay
SQL_tblCheck_STR = "SELECT * FROM INFORMATION_SCHEMA.TABLES " & _
"WHERE table_name = '" & xbl_Holdings_Name & "' "

Set MM_checkCmd = Server.CreateObject("ADODB.Recordset")
MM_checkCmd.ActiveConnection = conn_str_ClientDB
MM_checkCmd.Source = SQL_tblCheck_STR
MM_checkCmd.CursorType = 0
MM_checkCmd.CursorLocation = 2
MM_checkCmd.LockType = 3
MM_checkCmd.Open()


IF MM_checkCmd.EOF Then
xbl_Holdings_date = (xbl_Holdings_date - daysBack)
daysBack = daysBack + 1
tblFound = FALSE
ELSE
tblFound = TRUE
MM_checkCmd.CLOSE()
SET MM_checkCmd = Nothing
END IF
loop



The goal of this snippet is simply to identify and set the value for the existing table name.
An example table name would be "xbl_Holdings_2006_12_10".

I could have posted this question in the VB forum but I would like to push as much of the work onto SQL as possible and also - this sort of operation is more likely to be required of a dba imo.

View 1 Replies View Related

Finding Table Names

Jun 29, 2006

Is there a way i can create a query that gives me a list of all the table names in the database?

View 2 Replies View Related

Finding The Primary Key Of A Table.

Dec 3, 2007

I'm trying to find the primary key on a given table in SQL Server 2000 using SQL.  I'm querying the sysobjects table to find a given table, and then querying the sysindexes table.  I've ALMOST found what I'm looking for.   I see the indexes and columns etc. on the tables in the database, I just don't see the field that indicates that the index is the primary key.
Can anyone help?
Thanks, Alex

View 6 Replies View Related

Finding The Size Of A Table?

Oct 12, 2007

Hi All,

Do any of you know how I can find the size of a table in SQL server?

Cheers

Dave

View 3 Replies View Related

Finding Out Table Names

Jul 20, 2005

I'm fairly new to sql.I've got a database that all I want to do is view some records fromsome tables. But the thing is, I do not know the table names ortheir relationships.I've got access to the database thru query analyzer. Can someoneassist me in gettign the correct statements that will allow me to findout what tables exist in the database.

View 4 Replies View Related

Finding Rows Within A Table

Jun 25, 2007

When I open a table and need to make a change within a particular record...



How do I find the particular row that I am looking for? I seem to have to scroll through 600 records to find the one I need. I've found a search and replace function but it doesn't seem to work.



Thanks I appreciate any advice you can give me.



View 3 Replies View Related

Finding Table Names

Feb 19, 2008

I'm new here so bare with me for alittle bit.
When I go to a website how to I find out the table names in the data?

I mean how can I do "select * from ___" if I don't know the table name.

Thank you for any help,
S_R_S

View 5 Replies View Related

T-SQL (SS2K8) :: Write Into A Table User-entered Value And Increment That Number N Times As Existing Rows

Jun 25, 2014

I need to have a script where it ask the user for a value, the script will search for all records that match the value. Then it will display the numbers of records found and ask the user to enter a different value. The rest of the script will use this new value and increment by 1 n times as the number of records found. I started the script where it will ask for "HANDLE" and display the number of records found with that "HANDLE"

declare @HANDLE as varchar(30)
declare @COUNT as varchar(10)
declare @STARTINV as varchar(20)

set @HANDLE = ?C --This is the parameter to search for records with this value
set @STARTINV = ?C --User will input the starting invoice number
SELECT COUNT as OrderCount FROM SHIPHIST
where HANDLE = @HANDLE

I just can't figure out how to proceed to use the entered invoice # and increment by 1 until it reach the number of records found.

This will be the end results:

Count=5 --results from query
STARTINV=00010 --Value entered by user

Handle,Inv_Num
AAABBB,00010
AAABBB,00011
AAABBB,00012
AAABBB,00013
AAABBB,00014

View 9 Replies View Related

Stored Proc Not Finding Table

Jul 17, 2005

Need some suggestions on what to check or look for.My stored proc is not finding the table in the sql db.  This is the error...Invalid object name 'tblServRec'I use the same function to pass in an arraylist and the sp name for another sp and that one works ok.The sp is the same as another one except for the table name and that one works ok.The sp works fine on my local machine.  It finds the table ok.  But when I try it on the server, it doesn't work.I have checked permissions, and they are the same for all tables, even the one that the other sp works ok on the server.Here is the sp if that will help.....CREATE PROCEDURE dbo.deleteServRec
@fldNum    INT  ASBEGIN DECLARE @errCode   INT
 DELETE FROM tblServRec WHERE fldNum = @fldNum     SET @errCode = 0 RETURN @errCode
HANDLE_APPERR:
 SET @errCode = 1 RETURN @errCodeENDGOThanks all,Zath

View 4 Replies View Related

Finding Last DDL Activity Time In A Table

Nov 1, 2001

Hi Friends,

Is there any way to find the time when the last DDL was happened in a table?
For example: The time when the new column(s) were added into a table or changed the datatype.

Thanks for the help in advance.

--Raj

View 1 Replies View Related

Finding Table Modification Date

Oct 10, 2001

Is there a way to find out when the last modification or change to data in a table occured ? How about the last change of a view ?

We'd like to be able to extract data to another table based on a view. Then, at a later date, check to see if the first table or view has changed since the last extract. If not, then we don't need to re-extract the data, we know it hasn't changed.

View 1 Replies View Related

Finding Out Which Rows Have Been Updated In A Table

Feb 9, 2005

Can this be done easilly through a stored proc?

View 1 Replies View Related

Finding Table , Database Size

Sep 29, 2005

Hii all,

I want to find the database , table size in MS SQL Server.

Is there is any query /procedures to find out the database and table size.

Thanks in advance .,

Regards.,

Sri

View 5 Replies View Related

Finding Lowest Value In A Table Greater Than A Certain Value?

Dec 19, 2013

finding the first value to cross a specific threshold in SQL Server

LoadTemp1 LoadTemp2 LoadTemp3 TimeStamp
300 350 200 12-10-2013 13:30
177 238 333 12-10-2013 13:05
240 190 170 12-10-2013 12:45

How do I design query to find the first LoadTemp* that cross a threshold of 340 degrees per TimeStamp.

View 6 Replies View Related

Finding Products Code With A Table

May 29, 2008

Hi i've to table where i have a product code and a area code.

I want to insert the values from table 1 into table 2 if the product code and area code do not already exists in the table in table 2.

Am using this code below but it does not seem to be working.

select distinct p_code1, area_code
from table1
where not exists
(select p_code, area_code
from table 2 )

View 2 Replies View Related

Finding Suspected Abuse From Log-table

Jun 17, 2008

A client has a site, that requires users to log in, and each login is logged with IP in this table:

CREATE TABLE [dbo].[Event](
[EventId] [int] IDENTITY(1,1) NOT NULL,
[EventTypeId] [int] NOT NULL,
[IP] [varchar](50) NULL,
[UserId] [int] NULL
[DateCreated] [datetime] NOT NULL CONSTRAINT [DF_Event_DateCreated] DEFAULT (getdate()),
CONSTRAINT [PK_Event] PRIMARY KEY CLUSTERED
(
[EventId] ASC
)

How the client wants me to write a query, that will find "suspected abuse of accounts" - defined by being successful logins made within one hour from at least 3 different IPs.

So I need to check for events, that are within one hour from each other (datecreated field) and have the same userID - and EventTypeId - but at least 3 different IPs.

Maybe it's just late in the day or I am overworked, but I cant seem to find an effective way to approach this.

Ideas?

View 3 Replies View Related

Finding The Filegroups Associatted With A Table In T-SQL

Jul 20, 2005

Hi,I want to find out in my SP the filegroup associated with a particulartable? I was not able to establish the relationship between sysobjectsand sysfilegroups table. Is there any other way to find filegroup of atable in T_SQL?Also lets say there are 3 dtatfiles in a filegroup 'FG1' and table'xyz' is created on filegroup 'FG1' - Is there any way to find out thedatafile's names on which table xyz's data is scattered?Thanks in Advance,Subodh

View 1 Replies View Related

Finding Lower Case Data From Table

Jun 17, 2003

Hi,

My database is case insensitive. However, the application is case sensitive for the data in the table.

I need to find out the data from the table where the data is stored in lower case.

Here is the sample data:
Table: inv_manager
column: sku varchar(5)
Data: 1134X
1135x
1123a
b145Y

I just need query to return row 2, 3, 4.

Here is my query:

select sku from inv_manager where sku like lower('%[a-z]%')

The problem is it returns all the rows from the table including first one.

How can I return just the data with lower case ?

Thanks

View 2 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved