Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  Advanced Search
  HOME    TRACKER    MS SQL Server


SuperbHosting.net have generously sponsored dedicated servers to ensure a reliable and scalable dedicated hosting solution for BigResource.com.





When Was A Table Updated?


is there any way to know when was the table last touch (updated) in all scenarios (insert, delete, update, etc..)?




View Complete Forum Thread with Replies

Related Forum Messages:
Who/When Was A Table Updated?
How can I determine who and when a table in a db was updated, I dont need this per record, I only need to know the last time an update was made to a table. Thanks.

View Replies !
UPDATED Table
is there a such thing as a "UPDATED table".. as in a trigger's INSERTED table or DELETED table ....

View Replies !
Getting The Name Of The Updated Table
I am writing a generic trigger in VS 2005 that selects records from the inserted table, and updates an audit table. I am, however, unable to retrieve the name of the table that the insert occurred on. I am using the following code to select the records, and obtain the name.. Can anyone offer any alternatives to accomplishing this task? Thanks in advnace for any help you can provide.

Craig

SqlDataAdapter tableLoader = new SqlDataAdapter("SELECT * FROM inserted", connection);

DataTable insertedTable = new DataTable();

tableLoader.Fill(insertedTable);

string insertedTableName = insertedTable.TableName;

 

View Replies !
Linked Reports Not Being Updated When Master Report Is Updated
Since updating to SQL Server 2005 SP2 I've noticed two things about Linked Reports.
 
1.  I do a lot of 'Snapshot' reports.  With SP-1 if I updated a master report and made any changes to the Parameter List - it undid all my custom parameter changes on linked versions (restored to the Master Reports Defaults).  While this is no longer happening with SP2 - it is still 'unhiding' the parameters.
 
2.  With SP-1 if I added/deleted columns or made other changes to the report structure - the linked reports would pick up on the changes with their next refresh.  With SP-2 I'm finding that I have to 'Re-link' the linked report back to the master report before the changes are refreshed.  This is very time consuming especially with each report having 8 or more Snapshot reports pre-set up.
 
Am I missing something - or is this a 'bug'...
 
Any help would be appreciated...

View Replies !
Table Is Not Getting Updated Fully
Hi all,
i have a table1 with 3,25,000 records in US database.i want to upadate this table information in to table2 in SG database based on some condition (if prodid and skuno match in both tables, then update ordertransferind column in table2 from table1) what is happening is after 10,000 records query is not executing. in status bar it is displaying 'done'. but only 10,000 records are updating not the remaining ones. for this 10,000 records also it is taking more than 1 hour time. i tried by incresing the commandTimeout to max value(99999)...but still it is same...any advise...please suggest...
 i am using sql2005,visualstudio 2005....
 thanks for the help..
 
Anne

View Replies !
Current Updated Value In Table
hello all..
i  want to update my table information with the value which is currently inserted/updated in another table dynamically..how to get the value of a currently inserted single cell in that table..?
table1 contains Refno,.....Refno is primarykey,identity
table 2 contains uploadID,....uploadID is primary key,identity
table3 contains RefNo,UploadID(both r foriegn keys corresponding to table1 & table2)
how to fill table3 with values(not manually) when i am inserting records into table1 n table2 ..( refno and uploadId are identity columns )..Any Idea..?
 
thanks in Advance
Anne

View Replies !
Log_shipping_secondaries Table Not Updated
Hi,

I have configured the logshipping like this...

1. Primary server and monitoring server are same..
2. Service (SQL & Agent) startup account (Domainuser) on primary and secondary server are same and added to local Administrator group and builtinadministrators group in SQLServer.These accounts have access to msdb database..
3.Primary Server is is in a different timezone and 8 hours ahead of secondary.
4.Synchronisation is perfect on secondary server with primary server...

But the log_shipping_secondaries table in the monitoring/primary server was not being updated by the secondary server..And as a result log_shipping restore alert job is failing with a message that secondary server is outof sync by 2111 minutes...

Can anybody tell me the cause...

Regards,
NSR

View Replies !
SQL To Email When Table Is Updated?
I want to setup a method to get emailed whenever someone adds an item to a particular table.

I'm looking at SP's, and DTS's.. but i'm just not sure what the best path is.

http://www.sqldev.net/dts/SMTPTask.htm will create a great Custom DTS Email Task.. but then i don't know what to do next... I don't know how to say.. "If a new row is added, then run this DTS"... or if i should schedule the DTS to run every 30 minutes and then somehow query for new "Created" dates.

Please Help!

View Replies !
Table Identity After Updated
 

Hello all,
 
   I fixed a after update trigger with sql server 2005 and I need to return the last identity updated in the table to insert it into another table. How can i get the last Identity updated in a table?
 
Please help ..
Sms

View Replies !
Replicated Table Is Not Updated
Dear All,
i've made repliaction stup using the information guide below. all the things are done axactly. now i've inserted a row in the publisher. but i'm not getting the record at the subscriber database. please let me know where i'm missing

http://blog.csdn.net/longrujun/archive/2006/06/09/783357.aspx

Arnav
Even you learn 1%, Learn it with 100% confidence.

View Replies !
Last Updated Datetime In Table
How do I find who and when a particular table in SQL database 2005 was last updated.
Note that the table does not have a column which stores the last updated datetime.

TIA,
Andy

View Replies !
How To Find Out Which Field In A Table Is Updated
When someone modifies a field in a table, I like to find out whichfield he/she changed.Currently, only the LAST person to modify an object is saved. Forexample, if I modify an Application record, I will see "MyName" in the"tblApplications.UpdatedBy" field and the date and time I updated it.But it doesn't keep an historical record. We would like these changesto be stored in a file or a table or something.Please help

View Replies !
How Is Represented The Updated Table In A Trigger?
Hello

I am a newbie creating triggers and I would like to know what is the name of the updated logical table. That is, since the are identifiers like "inserted" and "deleted" that represent the inserted and deleted rows, respectivaly, I presumed that "updated" existed - but it does not.

I have a table with a column named "UpdatedTimeStamp" which I would like to update anytime the other columns are modified. I intended to create the following trigger:

create trigger myTrigger
on myTable
after update
as

update updated set UpdateTimeStamp=GetDate()

Of course, "updated" is not a valid identifier that represents the updated row.

Please, help me in creating this trigger. What is the correct way of doing a trigger like this?

Thanks a lot in advanced.

View Replies !
Determining Last Time A Table Was Updated (6.5, 7.0, 2k)
I am trying to find a global way of when the last time a row in one of my tables was updated or data inserted. I say global because I don't want to drill down through each table looking for modified rows.

I am a DBA of several hundred databases and want to retire those no longer being used.

Is there a column of a system table that has this info.

View Replies !
Finding Out Which Rows Have Been Updated In A Table
Can this be done easilly through a stored proc?

View Replies !
Updated Records From A Table Insert Into Another
Hi:

I need to create a trigger to save every record which has been updated in a table (e.g. "Contacts") into another (e.g. "Shadow_contacts). So basically something like a versioning on database level.
I have no experience with it and any precise hints/solutions would be very appreciated

selmahan

View Replies !
Needs To Move One Task To Another Once My ETL Table Gets Updated
 

Hi All,
 
I have SSIS package where i will be refreshing 5 cubes.  Here i am running my package every 15 minutes because i dont know when my ETL tables inserted once my ETL job is done.  My question is that i need to move to another task once my first cube get refreshed.  i.e when my first cube gets processed for first 15 minutes i will be updating some column as timestamp in ETL table.  And then i will be processing remaining four cubes.  For the second 15 minutes i should not process the same first cube rather i should process only the four cubes.  Because these four cubes data i am getting from different region. 
 
It can be done in SS 2000 under active x script task.  But i need to do it in SSIS under Script Task where i will be checking in ETL table whether my TimeStamp column has value or not.  Is it possible to do it?  Moreover we have option like disconnected edit in DTS 2000.  Is there any similar way to acheive?
 
Thanks in advance,
Anand Rajagopal
 

View Replies !
Send Email When DB Table Is Updated
Hi guys,
 
I am new to reporting services. I want to know how to send email whenever there is an update on TABLE_Customer. I have looked through data-driven subscription, but that is just normal schedulling. When i surf the net, i also found UpdateReportExecutionSnapshot. can i just put UpdateReportExecutionSnapshot inside my application so that when on UPDATE function, i will call UpdateReportExecutionSnapshot to trigger the snapshot to be updated?
 
Help... Thank you very much

View Replies !
Getting Primary Key Of The Updated Row In A Table Inside Trigger
Hi All,
I am using a trigger. I want to get the data of a row before updating inside this trigger and insert it into a backup table. Please anybody help me. Example with code is highly appreciated.

Thanks in advance.

View Replies !
Trigger (Instead Of Update) Doesn't Allow My Table Been Updated.
I have a Trigger Instead of Update.
When I Update my table, the trigger runs correctly but my table never is updated.
 
 
 

View Replies !
How To: Create A Table That Only Allows NULL Fields To Be Updated.
I need to create a table that only allows fields to be updated if the field value is NULL.  Is there anyway to configure a table in this manner? 
 
In the example below the record will be created with a serial number and verification ready flag set to true.  Other processes down stream will update the remaining fields as needed but should not update fields that have already been initialized.
 
Table Definition
 
USE [DB_AUTOMATED_PACKAGING_SYSTEM]
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[TBL_LABEL_VERIFICATION](
      [SerialNumber] [varchar](50) NOT NULL,
      [VerificationReady] [int] NOT NULL,
      [VoidLabelImage] [image] NULL,
      [VerifiedBy] [varchar](50) NULL,
      [VerifiedDate] [datetime] NULL,
      [Verified] [int] NULL,
 CONSTRAINT [PK_TBL_LABEL_VERIFICATION] PRIMARY KEY CLUSTERED
(
      [SerialNumber] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
 
GO
SET ANSI_PADDING OFF

View Replies !
Query To Find Table Updated In Last One Hour
Hi,
 

Does anyone know how to find out how many rows have been updated or deleted in a particular table for the last 1 hour?
 
Please reply.
 
Best Regards,
Ansaar
 


 

View Replies !
Java Alert When Database Table Updated
Hello Everyone,

I am new to connecting to databases through java and in fact have not done much database programming although I am fairly good at SQL.
I have used the MS JDBC driver to connect to a MS SQL server database but I want to update my application every time a record is added to the database and or alert the user.
From what I have read, i assume that I can create a Trigger in java but how do I get my trigger to call a method / run java code?
 
Thanks for your time and Help
 
Martin.

View Replies !
Update A Dataset From An Updated MSSQL Table
Here is my problem: I've created a table in MSSQL named MyReferences and then a typed dataset to connect to it.

 

Then I realized that I needed to add a column to MyReferences table and then I did it.

 

The problem is that I cannot find a way to add the new column to the typed dataset. I am unable to view it in the available columns.

 

Can anyone help me?

 

I'm using Visual Studio 2005 sp1 and C#.

 

Best regards

 

Alessandro

View Replies !
Replacing Tables In SQL Express By An Updated Table Of The Same Name Through VB2008 Code
Hello,
 
I have an application written in Visual Basic 2008, using a SQL Express 2008 database.  This application runs in several locations on stand-alone PC's and there is no network connecting them.
I have to maintain a SQL database in a central location an would like to be able to distribute updated tables from that central location by using an USB stick and replace the tables of the same name in the different locations with the updated ones on my USB stick.
This I would like to do using code within my VB2008 application.
 
Can someone please help me on the way to achieve this.  Is it possible to give some concrete code examples, as I am a newbie as a SQL Server user.
 
Many thanks and greetings,
 
Michel
 
 
 

View Replies !
SQLSERVER 2000,How Can I Detect The Last Time Where The Table Has Changed (updated)?
Hi, I wonder where I can see last update over a table. Maybe sqlserver write some information about every table.
 
For example there are 300 tables in a database an I want to execute some query to see the last tables updated (list of tables updated > 2008-01-02 )
 
Hope to be clear,
Best regards
Ariel
 
 

View Replies !
Save Updated Date When Row Is Updated
Hi,I want to save the last modification date when the row is updated. I have a column called "LastModification" in the table, every time the row is update I want to set the value of this column to the current date. So far all I know is that I need to use a trigger and the GetDate() function, but could any body help me with how to set the value of the column to getdate()? thanks for your help. 

View Replies !
Trying To Run A Schedule Dts Package Every 20 Minutes To Recreate A Table With Updated Data Into A Excell File
The only way the job success is if I select the option add rows wich is copying all rows even the ones that are already there, I tried to drop amd recreate the table option but i just dosn't run that way, help please..

View Replies !
Can &"Date Modified&" Col Be Automatically Updated W/o Trigger For Each Table?
Hello,
I am using SQL Server 2005 and ASP.NET 2.0. We have a very simple content management system where we have to keep track of date last modified for each row in all of our content tables. I know there's a "timestamp" datatype that is used for replication scenarios, but is there anything similar that I can use to set up a date_modified column for each of my content tables that will automatically update with GETDATE() whenever anything in a given row is updated?
Or do I have to create a date_modified column of smalldatetime datatype and write a trigger on update for EVERY single table of content that I have in the database? It seems there should be an easier way to do this than to write 20 triggers for my 20 content tables.
Thanks!

View Replies !
How To Correctly Update A Table Which Values Can Be Either Inserted/updated/deleted On Update?
Hi SQL fans,I realized that I often encounter the same situation in a relationdatabase context, where I really don't know what to do. Here is anexample, where I have 2 tables as follow:__________________________________________ | PortfolioTitle|| Portfolio |+----------------------------------------++-----------------------------+ | tfolio_id (int)|| folio_id (int) |<<-PK----FK--| tfolio_idfolio (int)|| folio_name (varchar) | | tfolio_idtitle (int)|--FK----PK->>[ Titles]+-----------------------------+ | tfolio_weight(decimal(6,5)) |+-----------------------------------------+Note that I also have a "Titles" tables (hence the tfolio_idtitlelink).My problem is : When I update a portfolio, I must update all theassociated titles in it. That means that titles can be either removedfrom the portfolio (a folio does not support the title anymore), addedto it (a new title is supported by the folio) or simply updated (atitle stays in the portfolio, but has its weight changed)For example, if the portfolio #2 would contain :[ PortfolioTitle ]id | idFolio | idTitre | poids1 2 1 102 2 2 203 2 3 30and I must update the PortfolioTitle based on these values :idFolio | idTitre | poids2 2 202 3 352 4 40then I should1 ) remove the title #1 from the folio by deleting its entry in thePortfolioTitle table2 ) update the title #2 (weight from 30 to 35)3 ) add the title #4 to the folioFor now, the only way I've found to do this is delete all the entriesof the related folio (e.g.: DELETE TitrePortefeuille WHERE idFolio =2), and then insert new values for each entry based on the new givenvalues.Is there a way to better manage this by detecting which value has to beinserted/updated/deleted?And this applies to many situation :(If you need other examples, I can give you.thanks a lot!ibiza

View Replies !
How Can I Set A Update Trigger On A Table In Database A After A Record Had Been Updated From Another Database B?
 

Hi guys, may I know is it possible to create an update trigger like this ? Assuming there are two database, database A and database B and both are having same tables called 'Payments' table.  I would like to update the Payments records on database A automatically after Payments records on database B had been updated. I can't use replication because both tables might having different records and some records are the same. Hope can get any assistance here, thank you.
 
Best Regards,
      Hans

View Replies !
How To Tell If A Row Is Updated
Hi Im doing a simple update in my SP:     update users    set Name = @Name    where id=@userID and password=@password i want to know if a row gets updated. for example if the userID and password dont match then the row will not get updated.so i want some way to tell if a row has been updated. how do i do this?thanks  

View Replies !
Updated
Thanks i just re tested again i think i had the database selected on the wrong one and was getting incorrect results.
Seems to be working just as i thought.
 
Snapshot  got record 1 here then if udpate to 2 then this does not update the 1 to 2
 
Cheers
 

View Replies !
SQL Help: Get The Record I Just Updated
Hi -
 apologies if this is not the right forum for this - I've searched a bit and this seems to be the best fit.
I have the following problem: I want to update records in a table that fit certain criteria. The way the insert logic works make sure that there will always be only one record that fits the criteria and I'd like to get the ID value of that record once the update went through. So here is what I tried:
 1 UPDATE Timeslot
2 SET StartTime = @StartTime, EndTime = @EndTime
3 WHERE (ProfessionalID = @ProfessionalID) AND (ProviderLocationID = @ProviderLocationID) AND (RequestID IS NULL) AND (StartTime > @StartTime) AND
4 (EndTime < @EndTime);
5 SELECT SCOPE_IDENTITY()

 My hope was that the select scope_identity would return the Timeslot ID of the row that was affected, but it doesn't. How do I get that row?
 Thanks!!!
Oliver
 

View Replies !
Query Cannot Be Updated Because The FROM
Hi everybody,
 I am a total noob conserning ASP, but I am willing to learn
We have a sql2005 SRV(hosted by our ISP, so limited access) and a ASP based forum (WEB WIZ)
When I try to login I get this error: Support Error Code:- err_SQLServer_loginUser()_update_USR_CodeFile Name:- functions_login.aspError details:-Microsoft OLE DB Provider for ODBC DriversQuery cannot be updated because the FROM clause is not a single simple table name.Can somebody tell me whats wrong?
Thanx in advance.
 Gerry de Bruijn!

View Replies !
Get Last Updated Records?
If I update a recordset a group of records using dynamic SQL where I update the TOP n records, is it possible to get the set of records that was updated?


CREATE PROCEDURE usp_Structural_ScheduleComponent
@cProject char(7),
@cComponentID char(10),
@iPour int,
@iQuantity int,
@iAvailable int OUTPUT,
@dtCast datetime OUTPUT
AS

SET @dtCast = convert(char(10), getdate(), 120)

DECLARE @cSql varchar(500)
SET @cSql = 'UPDATE tbStructuralComponentSchedule SET PourNumber = ' + CAST (@iPour AS VARCHAR) + ', ScheduledDate = ' + '''' + CAST(@dtCast AS VARCHAR) + '''' +
' WHERE EntryID IN ( SELECT TOP ' + CAST(@iQuantity AS VARCHAR) +
' FROM tbStructuralComponentSchedule ' +
' WHERE fkProjectNumber = ' + '''' + @cProject + '''' +
' AND fkComponentID = ' + '''' + @cComponentID + '''' +
' AND IssueDate IS NOT NULL' +
' AND ScheduledDate IS NULL' +
' ORDER BY EntryID DESC)'

EXEC(@cSql)
IF(@@ERROR <> 0 OR @@ROWCOUNT < = 0)
RAISERROR('Failed to add components to pour!',16,1)

SELECT @iAvailable = SUM(CASE WHEN IssueDate IS NOT NULL AND ScheduledDate IS NULL THEN 1 ELSE 0 END)
FROM tbStructuralComponentSchedule WHERE fkProjectNumber = @cProject AND fkComponentID = @cComponentID

GO

-- Is there a way to return the recordset that were modified in the update?

Mike B

View Replies !
How To Get Last Updated Date
Hi,
I am looking for a function (or something else) that shows me, when a row in MS SQL Server was updated the last time. is it possible?

thanks
deviant69

View Replies !
Updated Column Name
Hi,

Can anybody tell me how to find the column name(s) for recently updated table.

Thanks,

Kishore

View Replies !
Index Not Updated.
Hi,

We run SQL SERVER 2000 on win2000

I've a question regarding Index on a table.
I've a table (1 milj rows) with a extra index ZINDEX1.

Now lets say I insert 1000 rows in that table.

Now what will happend if I search on these NEW rows in my table.
The Index is not updated.

//Martin

View Replies !
Log All Updated Tables
We have a third party process that runs and updated several SQL tables.
Is there any way to find out what tables are being updated and store it in another table?

View Replies !
When Was Db Object Last Updated?
Guys,

Is there a way to find out when a certain DB object (e.g. Stored procedure) was last modified?

SYSOBJECTS table contains crdate and refdate fields. None of these, however, appear to tell me when when the object was last updated.

Any suggestions?


Thanks a lot

View Replies !
#of Rows Updated
Is there a command that will tell me the number of rows that are updated in a statement. I would like to put this in an Stored Procedure and pass the #rows updated back out.

View Replies !
Big Records Not Always Updated
In our database we have a memo field that sometimes coud be over 9 MBytes.
We are using the following code (VB) to update it

lReg = Len(fielText)
lOffset = 0
Do While lOffset < lReg
sChunk = Left(Right(fieldText, lReg - lOffset), 32768)
rs("document").AppendChunk sChunk
lOffset = lOffset + 32768
DoEvents
Loop
rs.Update

The problem is that sometimes the record is NOT updated and there is NO errors returned by SQLServer.

Do you have any suggestion? Is there another way to update records with big fields?

View Replies !
File Last Updated
Is there a way to tell when a file was last updated?

View Replies !
Database Is Not Updated
 

I am trying to insert data to a simple table using SQL express

However , I can see the data saved in the DataSet but not in the actual database.

If I try to insert the same user again , I got primary key violation ???

 

Here is the insert function :

string SqlConnection = @"Data Source=.SQLEXPRESS;AttachDbFilename=|DataDirectory|QJ.mdf;Integrated Security=True;User Instance=True";

SqlConnection Conn = new SqlConnection(SqlConnection);

SqlDataAdapter DataAdapter = new SqlDataAdapter("SELECT * FROM USERS", Conn);

SqlCommandBuilder ComandBuilder = new SqlCommandBuilder(DataAdapter);

DataAdapter.InsertCommand = ComandBuilder.GetInsertCommand();

DataAdapter.UpdateCommand = ComandBuilder.GetUpdateCommand();

DataSet DS = new DataSet();

DataAdapter.Fill(DS, "USERS");

DataTable DT = DS.Tables["USERS"];

DataRow DR = DT.NewRow();

DR["NAME"] = txtUserName.Text;

DR["Password"] = txtPass.Text;

DR["Type"] = 1;

DT.Rows.Add(DR);

DataAdapter.Update(DS,"USERS");

DS.AcceptChanges();

Conn.Close();

 

 

 

 

 

I dont know what I have done wrong

Please help

Thanks very much

View Replies !
Error{no Row Is Was Updated}
hey expert out ther..

i have encounter this error ..and i dont know what is the wrong with it..

the error goes:

No row was updated

Error source: .net SQLClient  Data provider

Error Message:string or binary data would be trancated.

plz help me to slove this prob.

thanks in advance!!!!!!!

 

View Replies !

Copyright © 2005-08 www.BigResource.com, All rights reserved