How To Find Out If A Spesific Table Has Changed?
Feb 28, 2008
Hi,
I have a small question regard how to find out if a specific table has chanced.
Is there any (sql)function inside MSSQL2005 that I can use to find if a spesific table has changed? I have heard of timestamp, but I don't know if that will solve my problem? Is there any thing in the sys.tables that kan help me, just do a fast query and check if a table has changed?
I'm developing a web-application with AJAX.NET, and I have UpdatePanels with datalist. When the tables in the db gets big the application is henging for a sec or two when it receiving the data, and when the timer (refresh rate) is 2 min it is not good! So my plan is to check if the table has chanced since last transfer of data, and if it has it will download the data, if not do nothing.
Jonny
View 4 Replies
ADVERTISEMENT
Mar 27, 2008
Is there a Tool/Utility/StoredProcedure/Query/View that can tell me the last time the data in a particular table was changed?
That change can be the result of either an ADD , INSERT, or DELETE statement.
I am using SQL Server 2005.
View 3 Replies
View Related
Aug 14, 2001
Is there any method so that I can find that the particular user has changed the record in the particualr table..?
View 1 Replies
View Related
Apr 2, 2015
I need to find all items in an inventory table where a field has been unticked in the last 24 hours (there is no audit trail), as well as the contract number of the contract it has been added to (it will not have existed in that table before).
These are the two table querys in their basic form:
select item (nvarchar(20)), inactive (bit) from inventory
select item (nvarchar(20) , contract (nvarchar(20)) , original_start_rent (datetime) from deltickitem
I would like to see just the item number and the contract number it has been added to.
View 11 Replies
View Related
Jul 22, 2014
I have a table (represented by #Events) that holds modifications made to another table. I do have some control over the table structure and indexing. I want to pull all of the change records that were made between two dates.
The tricky part is to include the previous version of each record, which will usually be found prior to the start date in question.
The code that I have provided below works. So you can use it to easily see what should be returned. But it's very slow in production.
Any better method to pull this data together?
-- Production version of this table has 4.5 million rows (roughly 1,000 rows per day)
-- Primary key is on L4Ident (clustered)
-- nonclustered index on ProcessDate, LinkRL4
DROP TABLE dbo.#Events;
DROP TABLE dbo.#Results;
CREATE TABLE dbo.#Events (
L4Ident int IDENTITY(1,1) NOT NULL,
[Code] ....
View 4 Replies
View Related
Jul 22, 2015
isn't there an automatic log of some sort to check and see what exactly was changed by a given SQL command? A stored proc was ran and I need to figure out what exactly it changed in the underlying table.
View 3 Replies
View Related
Jun 30, 2006
Hello, i need some help on this...
I need to make a job that execute a procedure at 7 am , and other at 8 pm, can any one give a hand with this?
Regards
View 6 Replies
View Related
Aug 12, 2014
I want Compare two Table data and insert changed field to the third table ...
View 9 Replies
View Related
Oct 25, 2015
we have a table in our ERP database and we copy data from this table into another "stage"Â table on a nightly basis. is there a way to dynamically alter the schema of the stage table when the source table's structure is changed? in other words, if a new column is added to the source table, i would like to add the column to the stage table during the nightly refresh.
View 4 Replies
View Related
May 20, 2015
Is it possible to check/notify if something (record) has changed in the linked table (from linked server) and automatically update table in local one?
View 4 Replies
View Related
Mar 1, 2004
Hi all,
How can i get the information as to when was the last my particular table structure was changed (for ex. adding of a column/dropping a column)
Pls let me know
TIA
View 3 Replies
View Related
Jul 20, 2005
When I create tables in SQL I can specify dbo as the owner using thesyntax below but when using the upsize wizard in Access 2000 I owneverything. Is there a way that the system administrator can changeownership after the fact?CREATE TABLE dbo.mytable (c1 int not null)Thank You,Randy KJoin Bytes!
View 1 Replies
View Related
Mar 6, 2008
Ha all again.
I have this issue:
I have 2 tables:
t1 (id,field1,field2,field3)
and t2 (id,field_name,field_value)
is possible with trigger to insert only changed fields on t1 to t2 like
(changing field1 on t1 with id 21 cause a new row in t2 with fields id=21,field_name="field1", field_value=field1.value)
i hope you understand what i look for.
Is this trigger solution ?
CREATE TRIGGER MAP_CHANGESON t1AFTER INSERT,UPDATEBEGIN
DECLARE @ID SOMEDATA;DECLARE @FIELD1 SOMEDATA;DECLARE @FIELD2 SOMEDATA;DECLARE @FIELD3 SOMEDATA;SET @ID=(SELECT ID FROM INSERTED)SET @FIELD1=(SELECT FIELD1 FROM INSERTED AS T1,DELETED T2 WHERE T1.ID=T2.ID AND T1.FIELD1<>T2.FIELD1)SET @FIELD2=(SELECT FIELD2 FROM INSERTED AS T1,DELETED T2 WHERE T1.ID=T2.ID AND T1.FIELD2<>T2.FIELD2)SET @FIELD3=(SELECT FIELD1 FROM INSERTED AS T1,DELETED T2 WHERE T1.ID=T2.ID AND T1.FIELD3<>T2.FIELD3)IF @FIELD1<>NULL INSERT INTO T2 (ID,FIELD_NAME,FIELD_VALUE) VALUES (@ID,'FIELD1','@FIELD1')IF @FIELD2<>NULL INSERT INTO T2 (ID,FIELD_NAME,FIELD_VALUE) VALUES (@ID,'FIELD2','@FIELD2')IF @FIELD3<>NULL INSERT INTO T2 (ID,FIELD_NAME,FIELD_VALUE) VALUES (@ID,'FIELD1','@FIELD3')RETURNEND
View 7 Replies
View Related
Jan 30, 2006
Hi..
I got 10 Tables with data in it for 100 Loans. The data can be Good and Bad .....
I had a Update Proc which Updates the 10 tables with the Good data what ever i pass...for this 100 Loans
Tha Proc will update the existing data in all tables whether it is Good or Bad Data.
when the updating is completed I want to know what are the Loans that were updated where there is a Bad Data in atleast one Field of the 10tables.
I don't want to check field by field in each table.... if there is a bad data and my proc updated with a Good Data i want to know that Loan.
Can any one has an idea on this,,,,
Thanks
Bob
View 2 Replies
View Related
Jan 7, 2000
When you setup a subscriber to a publication, that is pull the publication, does it copy all the rows or does it keep track of which rows changed.
View 1 Replies
View Related
Apr 6, 2015
I have a history table with the following values
CREATE TABLE History (SnapShotDate DATETIME, UID VARCHAR(10), DUEDATE DATETIME)
INSERT INTO History VALUES ('03-23-2015','PT-01','2015-04-22')
INSERT INTO History VALUES ('03-30-2015','PT-01','2015-04-20')
INSERT INTO History VALUES ('04-06-2015','PT-01','2015-06-30')
[Code] ....
I need an output in the below format. I need the most recent changed value for any given UID. Need to get the below result
OUTPUT
UID PreviousDueDate CurrentDueDate
----------------------------------------
PT-01 2015-04-20 2015-06-30
PT-02 2015-04-22 2015-04-22
PT-03 2015-04-18 2015-04-22
PT-042015-04-222015-04-18
View 4 Replies
View Related
Aug 18, 2014
How can I compare column in the same table and show only column and value that has been changed.
declare @t table (GroupID CHAR(6),Text1 VARCHAR(MAX),Text2 VARCHAR(MAX),Text3 VARCHAR(MAX))
insert into @t
SELECT '11111','Text1','Text2','Text3'
insert into @t
SELECT '11111','Text1','Text2','Text4'
END RESULTS:
Column Name Old New
Column 3 |'Text3' |'Text4'
View 9 Replies
View Related
Jan 15, 2007
Hello,I'm creating an audit table and associated triggers to be able to captureany updates and deletes from various tables in the database. I know how tocapture the records that have been updated or deleted, but is there any waythat I can cycle through a changed record, look at the old vs new values andcapture only the values that have changed?To give you a better idea of what I'm trying to do, instead of creating acopy of the original table (some tables have many fields) and creating awhole record if a type or bit field has been changed, I'd like to onlycapture the change in a single audit table that will have the followingfields;AuditID int INDENTITY(1,1)TableName varchar(100)FieldName varchar(100)OldValue varchar(255)NewValue varchar(255)AuditDate datetime DEFAULT(GetDate())Any direction would be greatly appreciated.Thanks!Rick
View 6 Replies
View Related
Dec 21, 2006
On sqlserver 2000 transactional replication:
How would I best go about changing a published table's column from smallint to int? I could not find anything about it in BOL or MS.com. I do not think EM/Replication Properties allows the change. I suspect I have to run "Alter Table/Column" on the Publisher and each Subscriber the old-fashioned way. Is that true?
Thanks!
View 3 Replies
View Related
May 30, 2006
Microsoft SQL Server 2000 - 8.00.2039
Got this error:
Could not complete cursor operation because the table schema changed after the cursor was declared. SQLCode: 16943 SQLState: HY000
Is this a known issue? I suspect the application logic may cause this error. Please advise.
Thanks a lot!
View 16 Replies
View Related
Jan 2, 2008
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 4 Replies
View Related
Jun 12, 2008
I have 3 database say
db1
db2
db3
I need to setup a script to read all the table names in the database above and then query the database to find the list of Stored Procedure using each table.(SQL Server)
View 5 Replies
View Related
Feb 14, 2008
Working on partitioning a few large tables. One of the tables included a text column and the €œTEXTIMAGE_ON [PRIMARY]€? clause which would prevent the partitioning of this table. After some research we found that the data was legacy and no longer used. We updated the column on the affected rows to NULLS and altered the column to a VARCHAR(20)
When I attempted to run the ALTER TABLE SWITCH I encountered the error
Msg 4947, Level 16, State 1, Line 1
ALTER TABLE SWITCH statement failed. There is no identical index in source table 'LocalDeltanet.dbo.testresultsjoe' for the index 'PKIDX_testSummary' in target table 'LocalDeltanet.dbo.testresults_part'.
After a lot of grief and testing I determined that the message was bogus and the real issue is that the 'sys.tables' still has €œlob_data_space_id€? with a value of 1 for this table.
I created a copy of the table with the text column altered to varchar and one with just the varchar to begin with. After copying data from the original table, I tried to run the alter switch. It failed once again for the text column altered to varchar table, but it worked for the varchar from the start.
Since it appears that this value is causing my issues, is there anyway to update the table in place. I know I can BCP the data out, but that would take too long and would defeat the advantage of using the alter switch method.
BOL States:
The allow updates option is still present in the sp_configure stored procedure, although its functionality is unavailable in Microsoft SQL Server 2005 (the setting has no effect). In SQL Server 2005, direct updates to the system tables are not supported. This means we cannot update the table manually.
Thanks
View 1 Replies
View Related
Feb 9, 2007
Hi,
My scenario:
I have a master securities table which has 7 fields. As a part of the daily process I am uploading flat files into database tables. The flat files contains the master(static) security data as well as the analytics(transaction) data. I need to
1) separate the master (static) data from the flat files,
2) check whether that data is present in the master table, if not then insert that data into the master table
3) If data present then move that existing record to an history table and then update the main master table.
All the 7 fields need to be checked to uniquely identify a single record in the master table.
How can this be done? Whether we can us a combination of data flow items or write a sql procedure to do all this.
Thanks in advance for your help.
Regards,
$wapnil
View 4 Replies
View Related
Apr 29, 2014
I have table 'stores' that has 3 columns (storeid, article, doc), I have a second table 'allstores' that has 3 columns(storeid(always 'ALL'), article, doc). The stores table's storeid column will have a stores id, then will have multiple articles, and docs. The 'allstores' table will have 'all' in the store for every article and doc combination. This table is like the master lookup table for all possible article and doc combinations. The 'stores' table will have the actual article and doc per storeid.
What I am wanting to pull is all article, doc combinations that exist in the 'allstores' table, but do not exist in the 'stores' table, per storeid. So if the article/doc combination exists in the 'allstores' table and in the 'stores' table for storeid of 50 does not use that combination, but store 51 does, I want the output of storeid 50, and what combination does not exist for that storeid. I will try this example:
'allstores' 'Stores'
storeid doc article storeid doc article
ALL 0010 001 101 0010 001
ALL 0010 002 101 0010 002
ALL 0011 001 102 0011 002
ALL 0011 002
So I want the query to pull the one from 'allstores' that does not exist in 'stores' which in this case would the 3rd record "ALL 0011 001".
View 7 Replies
View Related
Oct 6, 2006
Hi
I am using SQL Server 2005 Developer Edition.
I want a list of the following things from the database: -
Table Name , FileGroup Table resides on
Table Name, Index Name, FileGroup index resides on
To put it simply, consider the following example:-
Lets say I have a table XYZ in my database created on Filegroup F1. It has a PK PK1 nonclustered index on Filegroup F2.
List1
-------
XYZ F1
List2
---------
XYZ PK1 F2
Please do not tell me of sp_help <table> option
Regards
Imtiaz
View 1 Replies
View Related
Dec 21, 1998
I have a table name and I want to get the column name of the PK of this table.
Do you know how can I do this ?
View 1 Replies
View Related
Feb 28, 2006
I am trying to import a sql table from one sql database to another using DTS. I am getting an error and when I dblclick on the row it says
'Error at destination row 44324 .Errors so far encountered in this task 1. Unspecified error'
How do I find and list row 44324 ? Or is there something else I should do/check
TIA
View 1 Replies
View Related
Jul 6, 2007
Dear all,
i want to find the second max no from a column can anyone help me in this
View 3 Replies
View Related
Jul 23, 2005
I have a Product table with the columnsAcctNumProdCodeInvoiceDateI can have multiple rows for a given AcctNum:123 A 01/01/2005123 B 01/02/2005123 C 01/03/2005234 C 02/01/2004345 A 01/01/2005345 B 01/02/2005I need the max(InvoiceDate) and if the max for a given AcctNum is a ProdCode= B. So if the latest InvoiceDate is for a given AcctNum is B then returnthat row.123 B 01/02/2005Would not be returned because the max Invoice date for AcctNum 123 isProdCode C.345 B 01/02/2005Would be returned because the max Invoice date for AcctNum 345 is ProdCodeB.I can solve this using a cursor fairly easily by using a distinct AcctNum inthe cursor select and getting the max InvoiceDate for each AcctNum. This isa costly and I'm looking for a solution using temp tables or a query tohandle this problem.I hope I have made this clear enough (sorry if I was too verbose). Thanks inadvance for your help.-p
View 2 Replies
View Related
May 29, 2008
Hi Folks,
Can any one tell me how to find table which has max records, let say i hve 50 tables in my database so how to find particular table has max records.
Thnx & Regards
Deepa.
View 4 Replies
View Related
Sep 1, 2006
Dear all experts,
I need to find out some property of a tableAs following sql statement:
select mtable.name,mcolumn.name,mtype.name,mcolumn.is_identity
from sys.tables mtable, sys.all_columns mcolumn, sys.types mtype
where mcolumn.object_id = mtable.object_id
and mcolumn.system_type_id = mtype.system_type_id
and mtable.name in ('TestTable')
order by mtable.name,mcolumn.column_id
But there is no PK information.
Follwing sql statement shows the PK name of a table, but no composite info(which fields):
select mtable.name,mkey.name
from sys.key_constraints mkey, sys.tables mtable
where mkey.parent_object_id = mtable.object_id
and mkey.type = 'PK'
and mkey.name like 'TestTable'
How can I find which fields are PK in a table?thanks...
-Winson
View 7 Replies
View Related