I've got an application I've written that should be able to (using a table) insert, update or delete records in SQL Server 2005. It can insert and update fine but it cannot delete any records. I'm totally stumped for how to figure out what's going on. I can remote on to the Windows 2003 Enterprise Server without any trouble so I should be able to read any log files or open the SQL Managemenent tools. How do I figure out what the issue is? It's a very strange thing and I'm stumped.
I was importing records via DTSWizard, and I was having problems so I turned off Enforce Replicaton, Enforce FK Constraints on a couple of fields. I'm new with SQL Server so I'm not sure if this even caused the problem. (Do I need to turn these back on, or is this a Developer switch of some kind?)
The end result left me with duplicate records in the table, and I'm not able to delete any of them. This is the Error I got...
A problem occurred attempting to delete row 1. Error Source: Microsoft.VisualStudio,Datatools. Error Message: The row value(s) updated or deleted either do not make the row unique or they after multiple rows(2 rows).
If someone could tell me what I need to do so I can delete the records I'd really appreciate it.
Hello, I have been serching for weeks to resolve this problem. I am new to ASP.NET and trying to make the migration from ASP which I have programmed in for years. I am using Microsoft Visual Web Developer 2005 Express Edition and SQL Express Edtion. I have been working through the Microsoft Video Training at http://msdn.microsoft.com/vstudio/express/beginner/learningpath/ and created a web site using Tier 3 Lesson 8 as the model. My new web site which is a simple phone book applicaiton lets me read the table and select the record without any problem. But the update form lets me edit but when I attempt to Apply the update I get the following error. Server Error in '/Phonebook' Application. ObjectDataSource 'ObjectDataSource1' could not find a non-generic method 'Update' that has parameters: FirstName, LastName, PhoneNumber, BossGroup, Department, BossPickup, ShowInPhonebook, Type, Original_FirstName, Original_LastName, Original_PhoneNumber, Original_BossGroup, Original_Department, Original_BossPickup, Original_ShowInPhoneBook, Original_Type, Original_ItemID. Description: An unhundled expception occured during the execution of the current web request. Please review the stack trace for more information about the error and where it originiated in the code. The Stack Trace basiclly showes the same error as above. Also, when I attempt to delete the record I do not get an error but the record does not delete. What is interesting is that I can add a record so I do not believe that it is a security permissions issue. I have the ISS Authinication Method Enable Anonymous Access set on with full control. If anyone has any insight as to why this is occuring please let me know.
Hi,I have an sql database that has the primary key set to three fields,but has not been set as unique(I didn't create the table).I have 1 record that has 2 duplicates and I am unable to delete theduplicate entries.If I try to delete any of the three records(they are identical) I getthe message 'key column is insufficient or incorrect. Too many rowswere affected by update'.I am trying to do this within Enterprise Mgr.Any suggestion?Thanks much
Hi!I am able to add records to my SQL 2005 database using bound forms in myAccess application, but if I try to edit any records (not only the newrecords I create) using the same bound forms, I receive a write conflict.For the record, I am currently the only user of this application and my SQLServer database has only one userID. I used this userID to create all ofthe objects in the database and to connect to the database from Access. Thedata sources for the bound forms are linked tables, the record source typeis set to "Dynaset" and the record locks are set to "No Locks". "Opendatabases using record-level locking" is checked.The write error says that another user has changed the current record sinceit was opened (since I'm currently the only user this isn't possible) andasks me to copy my changes to the clipboard or drop the changes.Can anyone suggest what might be causing this? Thanks!
I am using Master Data Service for couple of months now. I can load, update, merge and soft delete data in MDS. Occasionally we even have to hard delete data from MDS. If we keep on soft deleting records in a MDS table eventually there will be huge number of soft deleted records. Is there an easy way to hard delete all the soft deleted records from all MDS tables in a specific Model.
I have been trying to solve the locking problem from past couple of days. Please help mee!!
Scenario: -------------- I have a SSIS package in which 2 data flow tasks. 1st data flow task deletes records from a 5 tables and the 2nd data flow task should insert records into 1 of the five tables after the success of 1st data flow task. This scenario runs in Transacation.
The above scenrio in the 2nd data flow task hangs in runtime. It does not complete. with sp_who2 command i could see that there is an intent share lock(LK_M_IS) on the table and the status is SUSPENDED.
I dont know how to come out of this locking. Please help.
Is there any way to delete an unwanted row on a table with 300 or more constraints with less modifications to contraints? Or is there any other way that can remove the unwanted row without much risk? Dropping the constraints is possible but re-adding the constraints may not be possible because the create constraint statements are not known. And readding the constraints may take time because the database physical size is around 1GB... Please help
When trying to delete a user on SQL server 2000, we recieve the message "You cannot drop the selected login ID because that login ID owns objects in one or more databases."
We've tried a number of operations to find the objects owned by the user by searching for this error message in Google but, none of those suggestions work.
My questions are; Why does this happen, How can we avoid it in the future?
Our software applicaiton is case sensistive, and if a SQL security login is not created that matches the Domain login to the method used in the application - somehow we are suck. We can't create a new security for the login, nor can we delete or use the existing one.
I created and scheduled a test snapshot publication and a push subscription using the sql server replication wizard. Tested it and it worked all fine as the data was regularly replicated to the destination server correctly.
After I was satisfied with the test I deleted the replication and subscription without any problem. But I noticed that the jobs created by the replication wizard had not been deleted. I was disappointed as I had also expected these to be deleted because there are no more any local publication or replication on the server.
I, then, tried to delete the job by right click - and then delete. But I am unable to delete the pubilcation and subscription jobs at all. When I try to delete the sql server 2005 the following error message appears:
--start-------------------------------------------------------------------- "Attempt to retrieve data failed for object for server <MYSERVER>" (Microsoft.SqlServer.Smo ) Addional Information
The job <jobname> does not exist on the server. (Microsoft.SqlServer.Smo) --End--------------------------------------------------------------------
Can anyone help me on how to delete all replication jobs.
Please help, it's urgent!! We are using sql server 2000 DB, Sa is trying to delete a user from the Great Plains application and got the follow error: Deleting the login failed for an unknown reason, contact your sql server administrator for assistance.
We have created and scheduled some test reports via Idera performance tool but we are unable to delete the reports. These are not custom reports and reports created with Schedule Email option in Idera. Unfortunately, I dera does not have any option to delete these reports and support is asking me if I tried this by deleting from SQL Server Reporting Services.I looked at the Reporting services but can't find any place to delete these reports. This link does not provide any support because I don't have these (Or Report Manager)----> Configuration Manager console, navigate to System Center Configuration Manager / Site Database / Computer Management / Reporting / Reporting Services.
URL....All I have is "Reporting Services Configuration Manager" under "Configuration Tools". How can I delete these reports from SQL Server Reporting services ?. Can I delete them from some tables in Reports databases ?. If so, what are the tables ?. I delete the jobs from SQL Server but the jobs are automatically created the next day emailing the reports again..
Somehow I got the value -1.#IND into several records in a table in SQL 2000 DB.
I assume that it is a kind of €œNot A Number€??
The problem I am facing now, is that I can not modify the value to a legal value. Nor can I delete the record that holds the number. I get the error message:
€œAnother user has modified the contents of this table or view, the database row you are modifying no longer exists in the database. Database error: €˜[Microsoft][ODBS SQL Server Driver][SQL Server] A floating point exception occurred in the user process. Current transaction is cancelled.€?
I'm using below script within the execute T-SQL statement task of the maintenance plan, which is created to delete the zip files older than 2 days, the task runs before the backup database task gets kicked off, but some how the task is not deleting the old .zip files.
Code being used within the task: output of the @delete_file variable within the delete command is Del X:SQLBackup*2015_05_06*.zip before it is passed to the final exec statement, the server is in EST time zone.
Hello, its hard to explain, i have a table like this: --userpage_visitors-- id bigint owner nvarchar(20) visitor nvarchar(20) created datetime Then i have some code like this: (@Visitor is send to the stored proc)DECLARE @lastuser nvarchar(20)SELECT TOP 1 @lastuser = visitor FROM userpage_visitors WHERE (owner = @UserName) ORDER BY created DESCIF (@lastuser <> @Visitor)BEGININSERT INTO userpage_visitors (owner, visitor, created) VALUES (@UserName, @Visitor, @Created)-- delete hereEND Now after i have inserted the new visitor into the table, i need to clean the table... so each user should have maximum of 30 visitors, so if the user i inserted above is the 31st user then i need to delete the first user, so i always have 30 fresch visitors,, if they have less then 30 visitors then nothing should happen. The question is, how can i get the 31th post? in mysql you can say that you want post 30, 31, but in mssql you only have the TOP to select limited posts, any ideas? Patrick
Hello, I have 3 tables with their columns as follows: + LabelsInDocs [LabelId] PK FK , [DocsId] PK FK + Labels [LabelId] PK , [LabelName] + Docs [DocId] PK , [DocUrl] I set Cascade Delete On so when I delete a Doc all records in LabelsInDocs will be deleted. However, when a Doc is deleted I want also to delete all records in Labels for the labels which do not have any Doc associated to it in LabelsInDocs. How can I do this? Thanks, Miguel
hello friends. i have table1 in aspnetdb.mdf and i have picturefile of columname.. datatype of picturefile is vchar(50) i want to delete my record automatically from my table1 after two weeks from inserting my record date.. i want to delete my picture file that located /pictures/tree.jpg (example).. pictures/tree.jpg was uploaded as picturefile on table1 by user before how can i do this ? cheers
Currently i writing a program to delete Records in the SQL database using VB.net language... BUT i not sure whether i am right??? Pls provide me with the coding using a command object to delete records in SQL database...thank...however i tried the codes below but not working ...Pls help
Dim StrConnection As String = "workstation id=""ET-T15404-PC1"";integrated security=SSPI; etc
Dim objConnection As New SqlConnection(strConnection) Dim strSQL As String = "Delete Seller.Admin FROMSeller WHERE Seller.no=tb.no" Dim dbComm As New SqlCommand(strSQL, objConnection)
Hello,I have a database called articlesI want to delete all articles from a subgroup e.g. DVDIf I am in the enterprisemanager what steps do I have to take to do thisthanks in advancePaul
I have some records that will not delete, whenever I run a deletestatement in the Query analyzer, it never completes the statement, andI am only deleting one record at a time. Can anyone tell me why arecord wouldn't delete?
my query is.. Select j.jobSubject,e.eOrganization ,jv.JobClick,j.jobID from dbo.tbl_Jobs jinner join dbo.tbl_Employer e on e.mId=j.jobCreatedByIDinner join dbo.tbl_JobView jv on jv.JobID=j.jobID order by jv.JobClick desc This query returns 1 to many records
But I need the query should return 0 to many record . .yes I have already know inner join does not handle my problem so plz suggest me which type of join would solve my problem
PLease help me with a intruiging problem with Stored Procedure, which is driving me mad.......
I wrote a Stored Procedure as listed below. I've included the options SET NOCOUNT ON SET QUOTED_IDENTIFIER OFF
the results are stored in a #Temp table
The SP executes fine on Query Analyzer, and shows the contents of the temp table. BUt when I run this SP using ASP, I got the following error ----------- ADODB.Recordset (0x800A0E78) Operation is not allowed when the object is closed. /test_site/test.asp, line 59 ------------
I've tried using Recordset.MoveNextRecordset, if at all there are more than one recordset, obviously I got the same error
select @Cnt = (SELECT count(*) FROM VW_PART_REP WHERE (REP = @REP)) print "Nos Of Party :"+ convert(char(1),@iCnt)
Create Table #Test2 (ID int identity,prod_desc nvarchar(100),pack nvarchar(100),ntp int)-- ,tot_qty int ,tot_amt int )
while @iCurLine <= @cnt begin SELECT @SQL= "ALTER TABLE #Test2 ADD " SELECT @SQL = @SQL + "party_qty"+convert(char(2),@iCurLine)+" int " set @iCurLine=@iCurLine+1 Exec (@SQL) print @sql end SELECT @SQL= "ALTER TABLE #Test2 ADD " SELECT @SQL = @SQL +"tot_qty int , tot_amt int " SELECT @SQL = @SQL exec (@SQL) print @SQL
select * from #Test2
--Create Table #Test1 (ID int identity,prod_desc nvarchar(100),pack nvarchar(100),ntp int,party_qty1 int ,party_qty2 int ,party_qty3 int ,party_qty4 int ,party_qty5 int ,tot_qty int ,tot_amt int ) set @iCurLine=1
--=============================================
--print '=================Product Name========================' DECLARE PROD_CUR CURSOR FOR SELECT distinct(prod_code) as prod_code,prod_desc,pack,ntp FROM VW_sales_sum WHERE (REP = @REP) group by prod_code,prod_desc,pack,ntp
Declare @SQL_ins VarChar(1000)
OPEN PROD_CUR FETCH NEXT FROM PROD_CUR INTO @temp_prod_code,@temp_prod_desc,@temp_pack,@temp_n tp
SET @SQL_ins = "Insert into "+@TableName+" values(" SET @SQL_ins = @SQL_ins +""""+ @temp_prod_desc+""","""+@temp_pack+""","""+convert(char(10),@temp_ntp)+""","
DECLARE Party_CUR1 CURSOR FOR SELECT party_code,party_name FROM VW_PART_REP WHERE (REP = @REP) group by party_code,party_name
DECLARE @SQL1 varchar(10),@SQL2 varchar(100) set @SQL2='' OPEN Party_CUR1 FETCH NEXT FROM Party_CUR1 INTO @temp_party_code,@temp_party_name
WHILE @@FETCH_STATUS = 0 BEGIN print "==Party_name :"+ @temp_party_name +"===Party_Code :"+convert(char(3),@temp_party_Code) set @tot_sale_qty=0 set @tot_sale_qty= (select sum(issuedqty)as tot_qty from vw_sales_sum where party_code =@temp_party_code and (REP = @REP) and (prod_code=@temp_prod_code)) if @tot_sale_qty IS NULL begin set @tot_sale_qty=0 print "===Tot Qty :"+convert(varchar(10),@tot_sale_qty) end else begin print "===Tot Qty :"+convert(varchar(10),@tot_sale_qty) end SELECT @SQL1 = @tot_sale_qty select@net_tot_sale_qty=@net_tot_sale_qty+@tot_sale_qty --print @SQL1 Select @SQL2 = @SQL2 + @SQL1 +","
FETCH NEXT FROM Party_CUR1 INTO @temp_party_code,@temp_party_name
END
CLOSE Party_CUR1 DEALLOCATE Party_CUR1 print '===============================' print @SQL2+convert(char(4),@net_tot_sale_qty)
I have a table, gdbdoc, that contains record-key pairs, linking records in another table. There is no significance in the order of the link: if records A and B are linked, then I don't care whether the link is A -> B or B -> A, and my normal query logic is SELECT ... Where DCIindiid = A ... union SELECT ... Where DCILinkid = A(DCIindiid = key1, DCILinkid = Key2) The link-creation process normally checks whether there is already a link in either direction. Thus before creating a link A->B the logic checks to see whether either the A->B or B->A link record exists, and a new link is not created if the link already exists in either direction. However recently one of my processes bypassed the reverse-link check, and I've ended up with a few hundred cases where there is both an A->B link and a B->A link. If I run a query: - select gd1.* from gdbdoc as gd1 join gdbdoc as gd2 on gd1.dciindiid = gd2.dcilinkid and gd1.dcilinkid = gd2.dciindiid this displays all the records where one record links A -> B and there is also another record that links B -> A. How do I write a query to delete ONE of the pair of duplicate records? I have two problems: - Problem 1: Table gdbdoc is keyed on (DCIindiid, DCILinkid). Both guids are needed to create a unique key, and the table does not have a single key field. You can't write DELETE gdbdoc where DCIIndiid, DCILinkid IN select gd1.dciindiid, gd1.linkid from gdbdoc as gd1 join gdbdoc as gd2 on gd1.dciindiid = gd2.dcilinkid and gd1.dcilinkid = gd2.dciindiid as the DELETE ... SELECT ... syntax only seems to support a single returned value. Problem 2. If we solved problem 1, we would (I think) delete BOTH the A->B link and the B->A link , whereas I only want to delete one of these links. Afterthought: Problem 2 seems easily solvable: add "Where gd1.DCIindiid < gd1.DCILinkid" to the DELETE ... statement. Although the concept of "<" doesn't really mean anything with a guid, this is accepted by SQL, and halves the number of records returned by the select. Obviously I don't care which of the two links (A->B or B->A) is deleted. Regards, Robert Barnes
I use a tabel for storin log data from a mail server. I noticed that I'm getting duplicate records, is there a way to delete the socond and/or third entry so I dont have any duplicates?
Userid is auto number, lastname and emailaddress are PK.
I want to delete duplicate records. If lastname and emailaddress are the same, only keep a record which createdate is the most newest date. See above example I only want to the record which userid is 3. I have alreday created a code which I attached below. This code onle keep a record which userid is 1.
Anybody can help me to solve this problem? Thanks.
============== My current code ==================== delete from userprofile where userprofile.userid in --list all rows that have duplicates (select p.userid from userprofile as p where exists (select lastname, emailaddress from userprofile where lastname = p.lastname and emailaddress = p.emailaddress group by lastname, emailaddress having count (userid)>1)) and userprofile.userid not in --list on row from each set of duplicate (select min(p.userid) from userprofile as p where exists (select lastname, emailaddress from userprofile where lastname = p.lastname and emailaddress = p.emailaddress group by lastname, emailaddress having count (userid)>1) group by lastname, emailaddress)
:confused: Urgent!! Hi there. I use MS SQL server. I would like to separate the data from one table to two tables refer to two reference tables and the following conditions:
Let say these two reference tables are called: Table A & Table B
Group A: 1. Same date in Table A & Table B 2. Same ID in Table A & Table B (ID is not unique) 3. Same name in Table A & Table B (Name is not unique)
Combine all of these three conditions for unique identifier.
I used the following SQL code to separate the required data that match the above conditions to the new table. (Code) select a.Project, a.Site, a.S_number, a.Field_ID, a.Method, a.Analyte, a.Result, a.Units, a.Qualifier, a.Dilution_Factor, a.Reporting_limit, a.Recovery_, a.Matrix, a.CAS_Number, a.Sample_Date, a.Received_Date, a.Prep_Date, a.Analysis_Date, a.Batch_ID, a.Data_Package_num_SDG, a.Lab_Sample_ID, a.Lab into APPL_union_exist from APPL_union_update a, Before_01012004_report b where a.Field_ID = b.[Field Sample] and a.Sample_Date = b.Collected and a.Analyte = b.Analyte
However, I don't know how to delete the data that copied to the new table in original table, or separate that to the new table. Wish someone can help me. Thanks a lot