.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

how to find who had recently updated/delete the table

Posted By:      Posted Date: October 04, 2010    Points: 0   Category :Sql Server


  i need to find who had updated or deleted the table in sql server 2000 ,please tell me the way to find it.

View Complete Post

More Related Resource Links

Can't perform Create, Update or Delete operations on 'Table(outbox)' because it has no primary ke



I'm a beginner in asp.net and I have some problem inserting data into sql server 2005 with linq.


my code is : 


        Dim Result As New SMS.SendResult
        If Result.status = 0 Then
            Label1.Text = "Your Message Sent Successfuly"
            Dim db As New IGSSDataContext
            Dim out As New outbox With {.ClientID = intRandomNumber, .From = User.Identity.Name, .TO = TextBox1.TabIndex, _
            .Time = Now, .Message = Message}
            out.ID = (ID)
            TextBox1.Text = ""

DTA doesn't find referenced table form stored procedure with SP_executesql

Using the SQL2008R2 profiler and DTA connected to a SQL2000 server. I created a tuning tracefile with profiler for a certain db on the sql2000 server because I need to tune 1 table in the database referenced by 3 parameterized stored procedures which built a query depending on the parameters and is executed with an sp_executesql statement. When I run the DTA loading the tracefile I see the exec stored procedure events with it's parameters and the message Event does not reference any tables. And that's it. The DTA generates no Recommendatioin at all. How can I get the exact sql statements in the tracefile so the DTA can do what he needs to do? Regards

I have 3 triggers defined on an sqlserver2008 table and I can't find them with c#

I've got the code below and when I run it, it always says there are 0 triggers in table.Triggers.  I added some debugging code checkin the table.HasDeleteTrigger, etc. and from that, I get the exception: "To accomplish this action, set property HasDeleteTrigger." when I try to set it to bool hasDeleteTrigger. I can get stored procedures find, just not triggers. Below is my problem code: foreach (Database database in databaseCollection) { if (database.Name.Equals(catalogName)) { // first we need to delete triggers associated with all tables that begin // with our prefix. we can skip our the framework tables because those // don't have triggers on them // grab all tables, filter for non prefixed ones in foreach loop so we can delete triggers from non prefixed ones results.AddRange(from Table table in database.Tables select table.Name); foreach (var tableName in results) { var table = new Table(database, tableName, CrSyncDbSchemaName); table.Refresh(); bool hasDeleteTrigger = table.HasDeleteTrigger; bool hasAfterTrigger = table.HasAfterTrigger; bool hasInsertTrigger = table.HasInsertTrigger;

Cannot find table 0

Hope someone can help.  When the page loads I am able to click the add button and it moves the selected person from one dataset to the next.  If I then try to move another person I get the error message 'Cannot find table 0'.  I have changed the text to bold where the error occurs. Here is my codestring sourceUser = (string)HttpContext.Current.Session["TargetUserID"];System.Data.DataSet blank = new System.Data.DataSet();System.Data.DataSet ds = new System.Data.DataSet(); protected void Page_Load(object sender, EventArgs e){ if (lstCopyTargetUsers.Items.Count < 1) { if (Page.IsPostBack) { Sage.Platform.Data.IDataService service = Sage.Platform.Application.ApplicationContext.Current.Services.Get<Sage.Platform.Data.IDataService>(); string connStr = service.GetConnectionString(); Sage.SalesLogix.Security.SLXUserService usersvc = (Sage.SalesLogix.Security.SLXUserService)Sage.Platform.Application.ApplicationContext.Current.Services.Get<Sage.Platform.Security.IUserService>(); Sage.Entity.Interfaces.IUser user = usersvc.GetUser(); string loggedinid = user.Id.ToString(); System.Data.OleDb.OleDbConnection conn = new System.Data.OleDb.OleDbConnection(connStr); conn.Open(); System.Data.OleDb.OleDbCommand reps = new Syste

I have added new fields to a table in SQLserver, why could not find these new fields in Analysis Ser

I have added new fields to a table in SQLserver, why could not find these new fields in Analysis Services database source view?  My version is 2005.

Delete Record From Table A that Is Not In Table B

I have two tables; Table A id, name 101, jones 102, smith 103, williams 104, johnson 105, brown 106, green 107, anderson   Table B id, name, city, state 101, jones, des moine, Idaho 103, williams, Corvallis, Oregon 104, johnson, Grand Forks, North Dakota 105, brown, Phoenix, Arizona 107, anderson, New York, New York   I need to delete records from Table A that are not in Table B.  My front end is writen in .net and I am using Data Access Layer along with a Business Logic Layer for data interaction.   I have tried at least seven variations of joining, right outer join, left outer join resulting in wiping our the entire table or nothing at all; not to mention deleting the record that ought to remain and keeping the record that needs to be deleted!   In my BLL I tried to capture the rowsAffected for the deletion by using-without success. Dim rowsAffected As Integer = Adapter.ID_Deletion(ID) If rowsAffected = 1 Then Exit Function Else Return rowsAffected = 1 End If   Please help.   MsMe.

Duplicate records find in table

  Hi ALL, I want to find the dynamically check the primary key values and remove the duplicate records.. please suggest it.   Regards Ram

Cube Refreshment with Data updated in Table

HI All, I have cube which is MOLAP,and i have created SSIS package to process the cube,now i want to start the job as soon as data got uploaded into the Relational database. Please guide me in this as i am new to ssas. Regards Shraddha

I have relation many to many - how can I delete records from intermediate table ?

I have tables: Books id title Authors id name BooksAuthors book_id author_id Entity Framework generated only models for tables Books and Authors in relation many to many. How can I delete from table BooksAuthors all records where book_id =5 ?

Get the count of the recently added records to a table

i need to create 2 temporary tables. The records inserted into the 2nd table is the same as that from table1. Now, i am inserting some other records into table 2.what i need is, to retrieve the count of the recently added records into table2.How to achieve this? 

Cannot find Table 0

Hi all! Having a bit of an issue here where I'm getting the error "Cannot Find Table 0" when executing an INSERT INTO sql statement. The fishy part is that the code half works -- the new information is submitted to the database. Here the code in question:Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load If Request.Form("TextColContent") = "" Or Request.Form("TextColTitleEN") = "" Or Request.Form("TextColTitleFR") = "" Then 'This is to display the information in the text areas (from database) Dim rst1 'As New DataTable Dim rst2 'As New DataTable Dim rst3 'As New DataTable rst1 = ExecSQLSelect("SELECT Top 1 News_Item_Content FROM r_BI_Welcome_News ORDER BY News_Item_ID DESC") rst2 = ExecSQLSelect("SELECT Top 1 News_Item_Title_EN FROM r_BI_Welcome_News ORDER BY News_Item_ID DESC") rst3 = ExecSQLSelect("SELECT Top 1 News_Item_Title_FR FROM r_BI_Welcome_News ORDER BY News_Item_ID DESC") formOpen.Text = "<FORM Action='add_news.aspx' Method='Post'>" textarea1.Text = "<TEXTAREA Rows=1 Cols=48 Name='TextColTitleEN'>" & rst2.Rows(0)("N

Delete objects from table using another table to select rows - help needed

I have one table named 'dbo.ac_Products'Within this table there is a column named 'ProductId'There is also another table named 'dbo.ac_CatalogNodes'Within this table there is a column named 'CatalogNodeId'and a column named 'CatalogNodeType'I need to delete all the rows from 'dbo.ac_Products' and 'dbo.ac_CatalogNodes' where 'ProductId' = 'CatalogNodeId' and 'CatalogNodeType' = 1Any help would be greatly appreciated!

join - delete table(s)

I have two table:Parent has the key Id, UserIdChild has PaymentId, UserIdTo view the data using DropDownList.I want to delete information that is selected in the DropDownList (SelectedValue).My code:        products_to_delete var p = from and db.tbl_Payments                                 WHERE p.PaymentType.Contains (DropDownList1.SelectedValue)                                 Join in and db.tbl_PaymentDetails                                 He p.ID equals s.PaymentId                                 select p;        db.tbl_Payments.DeleteAllOnSubmit (products_to_delete);        db.SubmitChanges ();This code onl

Delete one table record if the no more record are associated from another table

Hello All,   In my scenario I have two tables say Table A and Table B. Table A has 3 records   Id Name Value 1 ABC 123 2 XYZ 456 3 PQR 789   Now in another table I have 4 records   Id FName Lname TableAID 101 ABC XYZ 1 102 AAA BBB 1 103 XXX YYY 1 104 PPP QQQ 2   Now I display table B records in gridview when I select 3 records say id 101,102,103 and click on delete button. Table B selected records should be deleted and its working fine.   The problem is that in Table A record 1 ABC 123 is only associated with that many records so when I delete that record from Table B at that time the associated record in Table A should also be deleted as no more association with that record in Table B.   So please give me query or appropriate solution for that.  

Find all tables that depend on table with FK column

I need to write a stored procedure that when passed the id of a row on a table, will query all tables that are referencing that row and move the data to another row.  I am doing this because we have 2 seperate systems that are linked by a table and sometimes things get out of whack and you have to manually move information over. I have this query that can find all the dependent tables, my question is what would I add to this to obtain the name of the column that is the foreign key on that tables.  SELECT o.name[parentTable], o2.name[childTable] FROM sys.sysobjects o INNER JOIN sys.sysforeignkeys fk ON fk.rkeyid = o.id INNER JOIN sys.sysobjects o2 ON o2.id = fk.fkeyid AND o2.id <> o.id WHERE o.name = 'tablename' I want to do this as a query because I want the procedure to be able to detect any new tables that might have been added.

Delete Duplicate Records from MySQL table


I have Revision column in Quote table with time stamp (MySql table) now i am viewing the entire date and time my end user want to view only Date he doesnot want to see time how can i pull only date.i am displaying revision column in two ways one in grid view and another one in field value

Query in my Grid view
Dim query As String = "SELECT QuoteNumber,Revision,Vendor,PartNumber,status,Customer,Requestor from quotes"
On select check box in grid view, filed values will be loaded with data.

field value
txtRev.Text = dt.Rows(indx)("Revision").ToString()




How can I avoid error a Insert Store proc if he don't find any coloum in a table


I have created one Insert Proc for a table which has three Colourm. 

Id int, [Name] varchar (30), Phone varchar (15) I want to use this proc for another Table which has two coloum which is semiler with first table lie   Id int, [Name] varchar (30) I want to use one Insert Store Proc For two Table. I can avoid null value of parameter but but can't avoid if the coloum is not exist. 



ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend