Error Message On Attempted Duplicate Insert
Hi All, I have a web form that inserts information into two tables in sql 2005 database on a submit button click. I have a unique key on the tables preventing duplicate information which works fine. The problem I have is that at the minute if a users tries to insert a duplicate row they just get the built in sql error message. Is there a way I can validate the information before if goes into the database and display perhaps a label telling the user of their error or is there a way I can customize the build in sql error message? I've had a search on various forums and sites and can't find any info that would help me. Thanks in advance
Dave
View Complete Forum Thread with Replies
Related Forum Messages:
SQL Server Error Message - Operating System Error 10038: An Operation Was Attempted On Something That Is Not A Socket...
My apologies...I wasn't for sure where to post an error like this... Over the last 2 months I have gotten this SQL Server error (twice). All existing processes will continue to work, however no new processes can be created and users cannot connect to the server. This is the exact text of the message in the SQL Server error log. Operating system error 10038: An operation was attempted on something that is not a socket... Error: 17059, Severity: 18, State: 0 Error accepting connection request via Net-Library 'SSNETLIB'. Execution continuing. Error: 17882, Severity: 18, State: While we can typically just stop SQL Server Service and restart the services...I have found it is best to restart the machine during non-production times to take care of any 'residual' effects of this error. The SQL Server 2000 SP4 box with Windows 2003 Standard SP1 is well maintained by our I.T. team and it typically will run 4 or 5 months without a reboot. Thank you... ...cordell...
View Replies !
Inserting Of Duplicate Records Error Message
I would like to know what options I have with regards to trapping a duplicate record before it tries to post to a SQL database. I have set the column to unique in SQL. But when I try to use ASP and post a duplicate record I get a system error. I would like to just create a referential error to notify the user that they cannot post a duplicate record please try again. Any help would be greatly appreciated. RT
View Replies !
Error: 0xC002F304 At Bulk Insert Task, Bulk Insert Task: An Error Occurred With The Following Error Message: &&"Cannot Fetch A Row
I receive the following error message when I try to use the Bulk Insert Task to load BCP data into a table: Error: 0xC002F304 at Bulk Insert Task, Bulk Insert Task: An error occurred with the following error message: "Cannot fetch a row from OLE DB provider "BULK" for linked server "(null)".The OLE DB provider "BULK" for linked server "(null)" reported an error. The provider did not give any information about the error.The bulk load failed. The column is too long in the data file for row 1, column 4. Verify that the field terminator and row terminator are specified correctly.Bulk load data conversion error (overflow) for row 1, column 1 (rowno).". Task failed: Bulk Insert Task In SSMS I am able to issue the following command and the data loads into a TableName table with no error messages: BULK INSERT TableName FROM 'C:DataDbTableName.bcp' WITH (DATAFILETYPE='widenative'); What configuration is required for the Bulk Insert Task in SSIS to make the data load? BTW - the TableName.bcp file is bulk copy file as bcp widenative data type. The properties of the Bulk Insert Task are the following: DataFileType: DTSBulkInsert_DataFileType_WideNative RowTerminator: {CR}{LF} Any help getting the bcp file to load would be appreciated. Let me know if you require any other information, thanks for all your help. Paul
View Replies !
'Cannot Insert Duplicate Key' Error With Identity Column As PK
I guess there is first for everything...I had never seen error like this before Violation of PRIMARY KEY constraint 'PK_table1'. Cannot insert duplicate key in object 'table1'. The statement has been terminated. In this case Primary Key is Identity column. I do not include Idenity column in Insert statement. Incidently SQL server machines had cluster failure couple of days before. I am not sure whether it has anything to do with it. I see this error randomly. How should I debug it
View Replies !
SP Causes The Error Violation Of UNIQUE KEY Constraint Cannot Insert Duplicate Key
The following SP causes the error "Violation of UNIQUE KEY constraint 'AlumniID'. Cannot insert duplicate key in object [table name]. The statement has been terminated." AlumniID is the table's PK and is set to autoincrement. I'd appreciate any help or suggestions. 1 ALTER PROCEDURE dbo.sp_CreateUser 2 3 @UserID uniqueidentifier, 4 @UserName nvarchar(128), 5 @Email nvarchar(50), 6 @FirstName nvarchar(25), 7 @LastName nvarchar(50), 8 @Teacher nvarchar(25), 9 @GradYr int 10 11 AS 12 SET NOCOUNT ON; 13 --DECLARE @UserID uniqueidentifier 14 --SELECT @UserID = NULL 15 --SELECT @UserID = UserID FROM dbo.aspnet_Users WHERE LOWER(@UserName) = LoweredUserName-- AND @ApplicationId = ApplicationId 16 INSERT INTO [table] 17 (UserID,UserName,Email,FirstName,LastName,Teacher,GradYr) 18 VALUES (@UserID,@UserName,@Email,@FirstName,@LastName,@Teacher,@GradYr
View Replies !
Bulk Insert, Skip Rows With Duplicate Key Error?
Does sql server have a way to handle errors in a sproc which would allowone to insert rows, ignoring rows which would create a duplicate keyviolation? I know if one loops one can handle the error on a row by rowbasis. But is there a way to skip the loop and do it as a bulk insert?It's easy to do in Access, but I'm curious to know if SQL Server propercan handle like this. I am guessing that a looping operation would beslower to execute?
View Replies !
Error Message On Insert
Hi All, I have a form that inserts information into two tables in sql 2005 database. I have a unique key on the tables preventing duplicate information which works fine. The problem I have is that at the minute if a users tries to insert a duplicate row they just get the built in sql error message. Is there a way I can validate the information before if goes into the database and display perhaps a label telling the user of their error or is there a way I can customize the build in sql error message? I've had a search on various forums and sites and can't find any info that would help me. Thanks in advance Dave
View Replies !
Insert Into Error Message? Help
I apprecaite your hlep. I run this code and got an error message ----------------------------------------------------------- select customer_id ,company_name,CITY_AND_STATE, substring (city_and_state,1,CHARINDEX(',',city_and_state,0)-1)as city, substring (city_and_state,CHARINDEX(',',city_and_state,0)+2, 4) as state into validCustomers from customer This gave me an error: ------------------------------------------------- Server: Msg 536, Level 16, State 3, Line 1 Invalid length parameter passed to the substring function. The statement has been terminated. I am not sure what I am doing wrong
View Replies !
Insert Error Message
I ran the following script and got an error: I have same primary key column in both tables. One table is empty(the one i am trying to insert into) insert into drt2dev.dbo.DRT2CustomerMasterUniverse select * from drt2.dbo.DRT2CustomerMasterUniverse Error Message: table 'drt2dev.dbo.DRT2CustomerMasterUniverse' can only be specified when a column list is used and IDENTITY_INSERT is ON. Do i have to list every column to use identity_insert?? is there an alternate? thanks
View Replies !
Odbc Error Message On Insert?
Hello: A developer is trying inserts into a database(mssql 6.5, sp4). He received the following ODBC message: Microsoft][ODBC SQL Server Driver][DBNMPNTW]ConnectionTransact (GetOverLappedResult()). with some key data thereafter. The mechanism that is being used is a Jaguar component written in Powerbuilder and he is trying to insert into a table. The data originally comes from ORacle 8.0.4. The odbc dll on the server is 3.60.0319 sqlsvr32.dll dated 8/14/98. The seerver is NT 4.0 sp4. Technet has not been helpful. Has anyone seen this error before? How may I resolve it? Thanks. David Spaisman
View Replies !
Error Message: Cannot Insert Explicit Value
Hello Everyone, I am trying to insert a new record into a sql table and I get the following error message: Msg 544, Level 16, State 1, Line 1 Cannot insert explicit value for identity column in table 'tbl_MLS_ReportCriteria' when IDENTITY_INSERT is set to OFF. Here is the code: USE MLS INSERT INTO dbo.tbl_MLS_ReportCriteria (CriteriaID, Name, DisplayName, DetailedInstructions, TypeID, Source, DefaultValue, ValueField, DescriptionField, IncludeAllOption) VALUES ('65', 'Summary3', 'Tertiary Summarize By', NULL, '2', 'SelectOptions', 'Company', NULL, NULL, '0') What do I need to change and or look for? TIA Kurt
View Replies !
SQL Server 2005, INSERT INTO, Error Message
The following function I am trying to design is to INSERT data into a SQL Server 2005 database. It is called from a different function, parse_file();, which is looping through a .CSV file and returning each record as an array to recordInsert();. Here is the function code and SQL syntax PHP Code: function recordInsert($rs) { $host = 'Driver={SQL Server}; SERVER=SERVER; DATABASE=DATABASE'; $user = 'USER'; $pass = 'PASS'; $conn = odbc_connect($host, $user, $pass); $query = "INSERT INTO db.table VALUES ( {$rs['MODEL']}, {$rs['PID']}, {$rs['YEAR']}, {$rs['TOTAL_COST']}, {$rs['PARTS_COST']}, {$rs['LABOR_COST']}, {$rs['PROBCD']}, {$rs['FAIL_PART']}, {$rs['FAIL_PART_NAME']}, {$rs['MILES']}, {$rs['PROBLEM']}, {$rs['CAUSE']}, {$rs['REMEDY']}, {$rs['CLAIM_DATE']}, {$rs['APPRV_DATE']}, {$rs['FAIL_DATE']}, {$rs['SOLD_DATE']}, {$rs['UNIT_AGE']}, {$rs['DEALER']}, {$rs['DEALER_NAME']}, {$rs['ST']}, {$rs['ZIP']}, {$rs['CLAIM']}, {$rs['BTC']}, {$rs['PART_2']}, {$rs['PART_3']}, {$rs['PART_4']}, {$rs['PART_4']}, {$rs['PART_5']}, {$rs['PART_6']}, {$rs['JOBCD1']}, {$rs['JOBCD2']}, {$rs['JOBCD3']}, {$rs['JOBCD4']}, {$rs['PRLN']}, {$rs['RUN_DATE']} );"; $exec = odbc_exec($conn, $query); if(!$exec) { echo "Error: " . odbc_error($exec) . "<br /> " . odbc_errormsg() . "<br /> "; } else { echo "Executed.<br /> "; } } parse_file("file.csv", csv); I am receiving the following error when attempting to INSERT into the database. Code: [Microsoft][ODBC SQL Server Driver][SQL Server]The name "YFM700RVL" is not permitted in this context. Valid expressions are constants, constant expressions, and (in some contexts) variables. Column names are not permitted. I have tried googling the error and since it is a long error, it has been hard trying to find an answer. One solution I found (which wasn't a solution) was to add the '@' infront of the variables. It did not work. Kick in the right direction? Thanks.
View Replies !
Error: Process ID Attempted To Unlock A Resource It Does Not Own
we are using sql server 2005 standard edition with sp1 From last couple of days, I am getting lot of these errors- Process 304 unlocking unowned resource: OBJECT: 2:792809934:0 Process ID 304 attempted to unlock a resource it does not own: OBJECT: 2:792809934:0 . Retry the transaction, because this error may be caused by a timing condition. If the problem persists, contact the database administrator. A user request from the session with SPID 304 generated a fatal exception. SQL Server is terminating this session. Contact Product Support Services with the dump produced in the log directory. SqlDumpExceptionHandler: Process 304 generated fatal exception c0000005 EXCEPTION_ACCESS_VIOLATION. SQL Server is terminating this process. 2007-05-23 05:31:58.74 spid76 * ******************************************************************************* 2007-05-23 05:31:58.74 spid76 * 2007-05-23 05:31:58.74 spid76 * BEGIN STACK DUMP: 2007-05-23 05:31:58.74 spid76 * 05/23/07 05:31:58 spid 76 2007-05-23 05:31:58.74 spid76 * 2007-05-23 05:31:58.74 spid76 * 2007-05-23 05:31:58.74 spid76 * Exception Address = 00000000015F4502 Module(sqlservr+00000000005F4502) 2007-05-23 05:31:58.74 spid76 * Exception Code = c0000005 EXCEPTION_ACCESS_VIOLATION 2007-05-23 05:31:58.74 spid76 * Access Violation occurred reading address 0000000000000018 2007-05-23 05:31:58.74 spid76 * Input Buffer 68 bytes - 2007-05-23 05:31:58.74 spid76 * 16 00 00 00 12 00 00 00 02 00 00 00 00 00 00 00 00 00 2007-05-23 05:31:58.74 spid76 * S G L M e s 01 00 00 00 15 00 53 00 47 00 4c 00 4d 00 65 00 73 00 2007-05-23 05:31:58.74 spid76 * s a g e Q u e u e 73 00 61 00 67 00 65 00 51 00 75 00 65 00 75 00 65 00 2007-05-23 05:31:58.74 spid76 * S e l e c t 53 00 65 00 6c 00 65 00 63 00 74 00 00 00 2007-05-23 05:31:58.74 spid76 * 2007-05-23 05:31:58.74 spid76 * 2007-05-23 05:31:58.74 spid76 * MODULE BASE END SIZE 2007-05-23 05:31:58.74 spid76 * sqlservr 0000000001000000 00000000035FBFFF 025fc000 2007-05-23 05:31:58.74 spid76 * ntdll 0000000078EC0000 0000000078FF8FFF 00139000 2007-05-23 05:31:58.74 spid76 * kernel32 0000000078D40000 0000000078EB1FFF 00172000 2007-05-23 05:31:58.74 spid76 * MSVCR80 0000000078130000 00000000781FEFFF 000cf000 2007-05-23 05:31:58.74 spid76 * msvcrt 000007FF7FC00000 000007FF7FC85FFF 00086000 2007-05-23 05:31:58.74 spid76 * MSVCP80 000000007C420000 000000007C530FFF 00111000 2007-05-23 05:31:58.74 spid76 * ADVAPI32 000007FF7FEE0000 000007FF7FFE4FFF 00105000 2007-05-23 05:31:58.74 spid76 * RPCRT4 000007FF7FD30000 000007FF7FED8FFF 001a9000 2007-05-23 05:31:58.74 spid76 * USER32 0000000078C30000 0000000078D3BFFF 0010c000 2007-05-23 05:31:58.74 spid76 * GDI32 000007FF7FC90000 000007FF7FD28FFF 00099000 2007-05-23 05:31:58.74 spid76 * CRYPT32 000007FF7D180000 000007FF7D2DEFFF 0015f000 2007-05-23 05:31:58.74 spid76 * MSASN1 000007FF7D150000 000007FF7D179FFF 0002a000 2007-05-23 05:31:58.74 spid76 * Secur32 000007FF7E7F0000 000007FF7E811FFF 00022000 2007-05-23 05:31:58.74 spid76 * MSWSOCK 000007FF76FE0000 000007FF7705BFFF 0007c000 2007-05-23 05:31:58.74 spid76 * WS2_32 000007FF77150000 000007FF7717FFFF 00030000 2007-05-23 05:31:58.74 spid76 * WS2HELP 000007FF77140000 000007FF7714BFFF 0000c000 2007-05-23 05:31:58.74 spid76 * USERENV 000007FF7C4A0000 000007FF7C5A8FFF 00109000 2007-05-23 05:31:58.74 spid76 * opends60 00000000333E0000 00000000333E7FFF 00008000 2007-05-23 05:31:58.74 spid76 * NETAPI32 000007FF771B0000 000007FF77247FFF 00098000 2007-05-23 05:31:58.74 spid76 * SHELL32 000007FF7F190000 000007FF7FB97FFF 00a08000 2007-05-23 05:31:58.74 spid76 * SHLWAPI 000007FF7EF60000 000007FF7EFFAFFF 0009b000 2007-05-23 05:31:58.74 spid76 * comctl32 0000000000AF0000 0000000000C76FFF 00187000 2007-05-23 05:31:58.74 spid76 * psapi 000007FF7E1B0000 000007FF7E1BFFFF 00010000 2007-05-23 05:31:58.74 spid76 * instapi 0000000048060000 000000004806CFFF 0000d000 2007-05-23 05:31:58.74 spid76 * CLUSAPI 000007FF7B1C0000 000007FF7B1E3FFF 00024000 2007-05-23 05:31:58.74 spid76 * ole32 000007FF7ECE0000 000007FF7EF51FFF 00272000 2007-05-23 05:31:58.74 spid76 * OLEAUT32 000007FF7E9F0000 000007FF7EB03FFF 00114000 2007-05-23 05:31:58.74 spid76 * RESUTILS 000007FF7B310000 000007FF7B32BFFF 0001c000 2007-05-23 05:31:58.74 spid76 * sqlevn70 000000004F610000 000000004F7A3FFF 00194000 2007-05-23 05:31:58.74 spid76 * SQLOS 00000000344D0000 00000000344D5FFF 00006000 2007-05-23 05:31:58.74 spid76 * NTMARTA 000007FF7E2F0000 000007FF7E32BFFF 0003c000 2007-05-23 05:31:58.74 spid76 * SAMLIB 000007FF76F80000 000007FF76F95FFF 00016000 2007-05-23 05:31:58.74 spid76 * WLDAP32 000007FF7E780000 000007FF7E7E5FFF 00066000 2007-05-23 05:31:58.74 spid76 * rsaenh 000000000FFB0000 000000000FFEDFFF 0003e000 2007-05-23 05:31:58.74 spid76 * AUTHZ 000007FF7E2C0000 000007FF7E2ECFFF 0002d000 2007-05-23 05:31:58.74 spid76 * MSCOREE 000006427EE60000 000006427EED3FFF 00074000 2007-05-23 05:31:58.75 spid76 * msv1_0 000007FF7E330000 000007FF7E373FFF 00044000 2007-05-23 05:31:58.75 spid76 * iphlpapi 000007FF57250000 000007FF57280FFF 00031000 2007-05-23 05:31:58.75 spid76 * kerberos 000007FF77410000 000007FF774C2FFF 000b3000 2007-05-23 05:31:58.75 spid76 * cryptdll 000007FF7DAB0000 000007FF7DABEFFF 0000f000 2007-05-23 05:31:58.75 spid76 * schannel 000007FF7DB70000 000007FF7DBB0FFF 00041000 2007-05-23 05:31:58.75 spid76 * COMRES 000007FF7E920000 000007FF7E9E5FFF 000c6000 2007-05-23 05:31:58.75 spid76 * XOLEHLP 000007FF5C560000 000007FF5C566FFF 00007000 2007-05-23 05:31:58.75 spid76 * MSDTCPRX 000007FF67140000 000007FF67210FFF 000d1000 2007-05-23 05:31:58.75 spid76 * msvcp60 000000000AD30000 000000000AE19FFF 000ea000 2007-05-23 05:31:58.75 spid76 * MTXCLU 000007FF7B540000 000007FF7B569FFF 0002a000 2007-05-23 05:31:58.75 spid76 * VERSION 000007FF7FBF0000 000007FF7FBFAFFF 0000b000 2007-05-23 05:31:58.75 spid76 * WSOCK32 000007FF770F0000 000007FF770F9FFF 0000a000 2007-05-23 05:31:58.75 spid76 * DNSAPI 000007FF7E720000 000007FF7E76DFFF 0004e000 2007-05-23 05:31:58.75 spid76 * winrnr 000007FF7E820000 000007FF7E82AFFF 0000b000 2007-05-23 05:31:58.75 spid76 * rasadhlp 000007FF7E830000 000007FF7E836FFF 00007000 2007-05-23 05:31:58.75 spid76 * hnetcfg 000007FF6D1F0000 000007FF6D280FFF 00091000 2007-05-23 05:31:58.75 spid76 * wshtcpip 000007FF76FA0000 000007FF76FAAFFF 0000b000 2007-05-23 05:31:58.75 spid76 * security 000007FF77530000 000007FF77534FFF 00005000 2007-05-23 05:31:58.75 spid76 * msfte 0000000049980000 0000000049D2DFFF 003ae000 2007-05-23 05:31:58.75 spid76 * dbghelp 000000000D7F0000 000000000D949FFF 0015a000 2007-05-23 05:31:58.75 spid76 * WINTRUST 000007FF7E210000 000007FF7E25DFFF 0004e000 2007-05-23 05:31:58.75 spid76 * imagehlp 000007FF7E2A0000 000007FF7E2B2FFF 00013000 2007-05-23 05:31:58.75 spid76 * dssenh 000000000FF70000 000000000FFABFFF 0003c000 2007-05-23 05:31:58.75 spid76 * ntdsapi 000007FF7DAD0000 000007FF7DAF3FFF 00024000 2007-05-23 05:31:58.75 spid76 * xpsp2res 000007FF5C210000 000007FF5C4D6FFF 002c7000 2007-05-23 05:31:58.75 spid76 * CLBCatQ 0000000003600000 00000000036DDFFF 000de000 2007-05-23 05:31:58.75 spid76 * sqlncli 00000000337A0000 0000000033A5DFFF 002be000 2007-05-23 05:31:58.75 spid76 * COMCTL32 0000000003700000 00000000037EDFFF 000ee000 2007-05-23 05:31:58.75 spid76 * comdlg32 000007FF7D360000 000007FF7D3D6FFF 00077000 2007-05-23 05:31:58.75 spid76 * SQLNCLIR 0000000035000000 0000000035032FFF 00033000 2007-05-23 05:31:58.75 spid76 * msftepxy 000000000F130000 000000000F150FFF 00021000 2007-05-23 05:31:58.75 spid76 * xpstar90 0000000053C30000 0000000053CB4FFF 00085000 2007-05-23 05:31:58.75 spid76 * SQLSCM90 0000000053AD0000 0000000053ADBFFF 0000c000 2007-05-23 05:31:58.75 spid76 * ODBC32 000007FF63EB0000 000007FF63F16FFF 00067000 2007-05-23 05:31:58.75 spid76 * BatchParser90 00000000520C0000 00000000520ECFFF 0002d000 2007-05-23 05:31:58.75 spid76 * ATL80 000000007C630000 000000007C64DFFF 0001e000 2007-05-23 05:31:58.75 spid76 * odbcint 000007FF63DC0000 000007FF63DD7FFF 00018000 2007-05-23 05:31:58.75 spid76 * xpstar90 0000000010CC0000 0000000010CE5FFF 00026000 2007-05-23 05:31:58.75 spid76 * msxmlsql 0000000078800000 0000000078963FFF 00164000 2007-05-23 05:31:58.75 spid76 * msxml3 000007FF78A20000 000007FF78C2DFFF 0020e000 2007-05-23 05:31:58.75 spid76 * xpsqlbot 000000004A7C0000 000000004A7C7FFF 00008000 2007-05-23 05:31:58.75 spid76 * xplog70 0000000034730000 000000003473FFFF 00010000 2007-05-23 05:31:58.75 spid76 * xplog70 00000000125B0000 00000000125B2FFF 00003000 2007-05-23 05:31:58.75 spid76 * 2007-05-23 05:31:58.75 spid76 * P1Home: FFFFFADEC275F600: 2007-05-23 05:31:58.75 spid76 * P2Home: 0000000017F4DEA0: FFFFFADEC275F600 0000000017F4DEA0 0000000000000000 0000000017F4E660 0000800000000000 FFFFFADEC275F940 2007-05-23 05:31:58.75 spid76 * P3Home: 0000000000000000: 2007-05-23 05:31:58.75 spid76 * P4Home: 0000000017F4E660: FFFFFFFF00000001 0000000000000000 0000000100ECCEA8 0000000100ECCF60 0000000000000000 00000000E226E9C0 2007-05-23 05:31:58.75 spid76 * P5Home: 0000800000000000: 2007-05-23 05:31:58.75 spid76 * P6Home: FFFFFADEC275F940: 2007-05-23 05:31:58.75 spid76 * ContextFlags: 000000000010001F: 2007-05-23 05:31:58.75 spid76 * MxCsr: 0000000000001FA0: 2007-05-23 05:31:58.75 spid76 * SegCs: 0000000000000033: 2007-05-23 05:31:58.75 spid76 * SegDs: 000000000000002B: 2007-05-23 05:31:58.75 spid76 * SegEs: 000000000000002B: 2007-05-23 05:31:58.75 spid76 * SegFs: 0000000000000053: 2007-05-23 05:31:58.75 spid76 * SegGs: 000000000000002B: 2007-05-23 05:31:58.75 spid76 * SegSs: 000000000000002B: 2007-05-23 05:31:58.75 spid76 * EFlags: 0000000000010202: 0065002E0064006D 0046000000650078 004F004E005F0050 0053004F0048005F 00480043005F0054 003D004B00430045 2007-05-23 05:31:58.75 spid76 * Rax: 0000000100ECCF60: 0000000000000000 0000000100ECCEA8 0000000000000000 0065006300630041 0000000000000000 0000000000000000 2007-05-23 05:31:58.75 spid76 * Rcx: 0000000000000000: 2007-05-23 05:31:58.75 spid76 * Rdx: 0000000000000000: 2007-05-23 05:31:58.75 spid76 * Rbx: 0000000000000000: 2007-05-23 05:31:58.75 spid76 * Rsp: 0000000017F4E440: 0000000001B30DC0 FFFFFFFFFF000000 0000000000000000 0000000078D6E31C 00000000D44421C0 00000000015E8750 2007-05-23 05:31:58.75 spid76 * Rbp: 0000000017F4E660: FFFFFFFF00000001 0000000000000000 0000000100ECCEA8 0000000100ECCF60 0000000000000000 00000000E226E9C0 2007-05-23 05:31:58.75 spid76 * Rsi: 0000000273C15900: 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 0000000000000000 2007-05-23 05:31:58.75 spid76 * Rdi: 0000000000000000: 2007-05-23 05:31:58.75 spid76 * R8: 00000000D44421C0: 0000000000000000 0000000000000000 00000000D039C1D0 00000000E892C1D0 0000000000000001 00000000038203A0 2007-05-23 05:31:58.75 spid76 * R9: 0000000000000000: 2007-05-23 05:31:58.75 spid76 * R10: 0000000001000000: 0000000300905A4D 0000FFFF00000004 00000000000000B8 0000000000000040 0000000000000000 0000000000000000 2007-05-23 05:31:58.75 spid76 * R11: 0000000017F4E5C8: 00000000015E5847 00000000063C8080 00000000063C8130 0000000192CED0F0 0000000001541382 FFFFFFFFFFFF0002 2007-05-23 05:31:58.75 spid76 * R12: 0000000017F4E608: 00000000063C4C58 0000000000000000 0000000000000000 00000000000002AA 0000000017F4E890 0000000100ECCE70 2007-05-23 05:31:58.75 spid76 * R13: 0000000000000001: 2007-05-23 05:31:58.75 spid76 * R14: 0000000000000000: 2007-05-23 05:31:58.75 spid76 * R15: 0000000000000000: 2007-05-23 05:31:58.75 spid76 * Rip: 00000000015F4502: 086F8B4C187A8B48 C1F6434FB60F2074 44004E814E850F02 0F04C1F660244C89 4C894C004E815985 30250C8B48657824 2007-05-23 05:31:58.75 spid76 * ******************************************************************************* 2007-05-23 05:31:58.75 spid76 * ------------------------------------------------------------------------------- 2007-05-23 05:31:58.75 spid76 * Short Stack Dump 2007-05-23 05:31:58.75 spid76 00000000015F4502 Module(sqlservr+00000000005F4502) 2007-05-23 05:31:58.75 spid76 00000000015E5847 Module(sqlservr+00000000005E5847) 2007-05-23 05:31:58.75 spid76 000000000158A7CE Module(sqlservr+000000000058A7CE) 2007-05-23 05:31:58.75 spid76 00000000024796E7 Module(sqlservr+00000000014796E7) 2007-05-23 05:31:58.75 spid76 000000000247A0E5 Module(sqlservr+000000000147A0E5) 2007-05-23 05:31:58.75 spid76 0000000001A2F32F Module(sqlservr+0000000000A2F32F) 2007-05-23 05:31:58.75 spid76 0000000001625988 Module(sqlservr+0000000000625988) 2007-05-23 05:31:58.75 spid76 0000000001736E0B Module(sqlservr+0000000000736E0B) 2007-05-23 05:31:58.75 spid76 000000000161BC5B Module(sqlservr+000000000061BC5B) 2007-05-23 05:31:58.75 spid76 00000000016126D1 Module(sqlservr+00000000006126D1) 2007-05-23 05:31:58.75 spid76 0000000001614BB6 Module(sqlservr+0000000000614BB6) 2007-05-23 05:31:58.75 spid76 000000000268C3CA Module(sqlservr+000000000168C3CA) 2007-05-23 05:31:58.75 spid76 000000000268DCB4 Module(sqlservr+000000000168DCB4) 2007-05-23 05:31:58.75 spid76 000000000161FC5E Module(sqlservr+000000000061FC5E) 2007-05-23 05:31:58.75 spid76 00000000015C80E8 Module(sqlservr+00000000005C80E8) 2007-05-23 05:31:58.75 spid76 00000000015CAD6D Module(sqlservr+00000000005CAD6D) 2007-05-23 05:31:58.75 spid76 00000000015E0232 Module(sqlservr+00000000005E0232) 2007-05-23 05:31:58.75 spid76 00000000015DE73E Module(sqlservr+00000000005DE73E) 2007-05-23 05:31:58.75 spid76 00000000015D66CE Module(sqlservr+00000000005D66CE) 2007-05-23 05:31:58.75 spid76 00000000015D7129 Module(sqlservr+00000000005D7129) 2007-05-23 05:31:58.75 spid76 00000000015CE674 Module(sqlservr+00000000005CE674) 2007-05-23 05:31:58.75 spid76 00000000014CE4C7 Module(sqlservr+00000000004CE4C7) 2007-05-23 05:31:58.75 spid76 00000000017A0B89 Module(sqlservr+00000000007A0B89) 2007-05-23 05:31:58.75 spid76 0000000001785C90 Module(sqlservr+0000000000785C90) 2007-05-23 05:31:58.75 spid76 00000000017D08F8 Module(sqlservr+00000000007D08F8) 2007-05-23 05:31:58.75 spid76 00000000781337A7 Module(MSVCR80+00000000000037A7) 2007-05-23 05:31:58.77 spid76 0000000078133864 Module(MSVCR80+0000000000003864) 2007-05-23 05:31:58.77 spid76 0000000078D6B66A Module(kernel32+000000000002B66A) Can anyone help me these errors? Why I am getting these errors ? And how do i resolve this issue? Thanks
View Replies !
Error - Attempted To Read Or Write Protected Memory
Hi, I am back with one more problem.. I have created few reports using SSRS 2005. I am using Oracle database in Data Source to fetch my data. It is working fine and showing me report correctly. But after running the report 8 to 10 times, it starts giving me Memory error. To get rid of that, I need to recycle (stop-start) ReportingService from IIS. I am exactly getting following error... Attempted to read or write protected memory. This is often an indication that other memory is corrupt. I am not getting the actual problem, why is it giving memory error only after running few times? Please let me know if anyone facing same problem or knowing the solution for the problem. Thanks, HMaheta
View Replies !
Preventing The Message 'Duplicate Key Was Ignored'
My problem is that the 'INSERT INTO' query that sends the records to thetable is dynamically compiled in VBA and and the target table has a twocolumn primary key. I have made a number of attempts at getting 'WHERENOT EXISTS' to cure the problem but so far without success and previouspostings have resulted in advice to create an 'ignore duplicates' index.This solved the problem in asmuch as it allowed the SQL to insert the records that did not alreadyexist but resulted in the message appearing every time the user ran thethe query. Whilst this is not a major problem it is vaguely irritatingand I would like to find a way to stop it happening. I suspect that thesolution may involve using the @@ERROR command but I am not sure of thesyntax.RegardsColin*** Sent via Developersdex http://www.developersdex.com ***
View Replies !
CREATE TABLE DUPLICATE OBJECT/DUPLICATE FIELD NAME ERROR Msg 2714
Hello Everyone: I am using the Import/Export wizard to import data from an ODBC data source. This can only be done from a query to specify the data to transfer. When I try to create the tables, for the query, I am getting the following error: Msg 2714, Level 16, State 4, Line 12 There is already an object named 'UserID' in the database. Msg 1750, Level 16, State 0, Line 12 Could not create constraint. See previous errors. I have duplicated this error with the following script: USE [testing] IF OBJECT_ID ('[testing].[dbo].[users1]', 'U') IS NOT NULL DROP TABLE [testing].[dbo].[users1] CREATE TABLE [testing].[dbo].[users1] ( [UserID] bigint NOT NULL, [Name] nvarchar(25) NULL, CONSTRAINT [UserID] PRIMARY KEY (UserID) ) IF OBJECT_ID ('[testing].[dbo].[users2]', 'U') IS NOT NULL DROP TABLE [testing].[dbo].[users2] CREATE TABLE [testing].[dbo].[users2] ( [UserID] bigint NOT NULL, [Name] nvarchar(25) NULL, CONSTRAINT [UserID] PRIMARY KEY (UserID) ) IF OBJECT_ID ('[testing].[dbo].[users3]', 'U') IS NOT NULL DROP TABLE [testing].[dbo].[users3] CREATE TABLE [testing].[dbo].[users3] ( [UserID] bigint NOT NULL, [Name] nvarchar(25) NULL, CONSTRAINT [UserID] PRIMARY KEY (UserID) ) I have searched the "2714 duplicate error msg," but have found references to duplicate table names, rather than multiple field names or column name duplicate errors, within a database. I think that the schema is only allowing a single UserID primary key. How do I fix this? TIA
View Replies !
To Display An Alert Message While Inserting A Duplicate Record
I am duplicating a record from my asp.net page in to the database. When i click on save I am getting the following error message Violation of PRIMARY KEY constraint 'PK_clientinfo'. Cannot insert duplicate key in object 'clientinfo'. The statement has been terminated. The above message i am getting since i have tried to duplicate the clientname field of my table which is set as the primary key. What i want is instead of this message in the browser i need to display an alert saying "the clientname entered already exists" by checking the value from the database. Here is my code. pls modify it to achieve the said problem if(Page.IsValid==true) { conn.Open(); SqlCommand cmd = new SqlCommand("insert into clientinfo (client_name, address) values ('"+txtclientname.Text+"', '"+txtaddress.Text+"')", conn); cmd.ExecuteNonQuery(); conn.Close(); BindData(); txtclear(); System.Web.HttpContext.Current.Response.Write("<script>alert('New Record Added!');</script>"); Response.Redirect("Clientinfo.aspx"); }
View Replies !
&&"Attempted To Read Or Write Protected Memory Error&&" In SSIS
I'm trying to import data from a Sybase ASE 12.0 database called "OurTestDatabase" into MS SQL Server 2005. I started SSIS Wizard and indicated "Sybase ASE OLEDB Provider" as a source and SQL Native Client as the target. I'm gettign the following error message: ----------------------------------------------------------------------------------------------------------------- Cannot get supported data types from the database connection "Provider=Sybase.ASEOLDEDBProvider;Password=;Persist Security Info=True;User ID=sa;Data Source=sybase;Initial Catalog=OurTestDatabase" Additional information |_ Attempted to read or write protected memory. This is often an indication that other memory is corrupt. (System.Data) ----------------------------------------------------------------------------------------------------------------- The same data source worked with DTS when we thought we'd convert to MS SQL Server 2000. Is this a bug in SSIS? What can be done? Using ".Net Framework Provider for ODBC" is not a good option because this doesn't allow me to choose any tables from the Sybase source. Any help is greatly appreciated.
View Replies !
INSERT INTO... SELECT... Cannot Insert Duplicate Key...
I want to add the content of a table into anotherI tried to copy all fields, except the primary key:INSERT INTO table2(field2, field3, field4, ...)SELECT field2, field3, field4, ...FROM anotherDB.dbo.table1gives the following error:Violation of UNIQUE KEY constraint...Cannot insert duplicate key...Why?I didn't ask him to copy the key column; Isn't the SQL Server supposedto know how to increment the key ?
View Replies !
Cannot Insert Duplicate Key
I am using SQL Server 2000. I have a table (tbDupes) with duplicate records. I want to populate another table (tbUnique) with unique records. My tbDupes has about 50 columns and three of them make up my primary key in tbUnique. I thought I could get unique records by using the following SQL statement. Code Snippet INSERT INTO tbUnique SELECT * FROM tbDupes I received this error: Cannot insert duplicate key Is there a database setting that will allow me to insert the first record and prevent any duplicates from being inserted? I thought this was the default behavior and think that maybe the DBA changed it. I know I can achieve this by creating a cursor with tbDupes and then something like "IF NOT EXISTS(...) THEN INSERT". However, I would prefer to avoid using a cursor.
View Replies !
Cannot Insert Duplicate Key Row In Msrepl_transactions
We have an issue that our SQL Replication between our Application Server (holding 13 months of data) and our Reporting Server (holding 5-6 years of data). Both systems are running on NT4, SQL Server 7 Ent SP3. Our issue is that we used to run SQL Replication but then stopped using it, and used another method of replicating our data from the App Svr to Rpt Svr. However, we have now been told that we have to use SQL Replication. We set it up as usual, but when the log reader starts up, it finds the 1st transaction and moves it into the distribution database, but it then fails when attempting to do the 2nd transaction with the error "Cannot insert duplicate key row in object MSrepl_transactions with unique index ucMSrepl_transactions. We have checked the tables in the publisher db and they don't hold any duplicates, so I can only assume the key it is talking about is the key field in the distribution database, but this is a Binary field which I believe is populated by replication itself!! Is this correct? If so, why is it trying to enter duplicates? And can we resync replication to fix it?
View Replies !
Don't Insert Duplicate Rows
Hi, I need to insert rows into table1 from table2 and table3 but I don't want to insert repeated combinations of col2, col3. So, table1 has the primary key col2, col3. This the table1: create table table1( col1 int not null, col2 int not null, col3 int not null, constraint PK_table1 primary key (col2, col3) ) This is my "insert" code: INSERT INTO table1 SELECT table2.col1,table2.col2, table3.col3 FROM table2, table3 WHERE table2.col1 = table3.col1 Wich conditions shoud i add to this code? Thanks. fmilano.
View Replies !
Cannot Insert Duplicate Key Row In Object
The following quote is the exact error message that I get when I attempt to create a pull subscription. The STAppointment is one of a 15 databases that need to replicate inorder for the application SalonTouch to run properly. What is causing this error? Is it user rights? Is it a problem with sql2005? Am I missing a step? Is there a problem with the database I am working with? What else? TITLE: New Subscription Wizard ------------------------------ SQL Server could not create a subscription for Subscriber 'D6LHWQ91PORTSUN9'. ------------------------------ ADDITIONAL INFORMATION: An exception occurred while executing a Transact-SQL statement or batch. (Microsoft.SqlServer.ConnectionInfo) ------------------------------ Cannot insert duplicate key row in object 'dbo.MSmerge_replinfo' with unique index 'uc1MSmerge_replinfo'. The subscription could not be created. The subscription properties table 'MSsubscription_properties' does not exist in the current database. Changed database context to 'STAppointment'. The statement has been terminated. (Microsoft SQL Server, Error: 2601) For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&ProdVer=09.00.2047&EvtSrc=MSSQLServer&EvtID=2601&LinkId=20476 ------------------------------ BUTTONS: OK ------------------------------
View Replies !
Trying To Append A Field If An Insert Happens To Contain A Duplicate
I deliberately intend to add some duplicates to one of my tables. For eg Job User IsAdmin JobID 235User ID 1 JobID 235User ID 5 JobID 235User ID 9 JobID 235User ID 5 JobID 235User ID 2 JobID 235User ID 9 JobID 235User ID 10 JobID 235User ID 1 I know its bad practice to do such a thing but there is a genuine reason. What I need to do is to be able to have a SQL statement that appends true to the IsAdmin field whenever it encounters the next UserID thats happens to be a duplicate. Hence the above would look like: Job User IsAdmin JobID 235User ID 1 JobID 235User ID 5 JobID 235User ID 9 JobID 235User ID 5 True JobID 235User ID 2 JobID 235User ID 9 True JobID 235User ID 10 JobID 235User ID 1 True Thanks
View Replies !
Preventing Duplicate Rows On Insert
I have a table using an identity column as its Primary Key and twocolumns (table reduced for simplicity) EmployeeNumber and ArrivalTime.CREATE TABLE [tblRecords] ([ID] [bigint] IDENTITY (1, 1) NOT NULL ,[EmployeeNumber] [varchar] (10) COLLATE SQL_Latin1_General_CP1_CI_ASNOT NULL ,[ArrivalTime] [datetime] NOT NULL ,CONSTRAINT [PK_tblRecords] PRIMARY KEY CLUSTERED([ID]) ON [PRIMARY]) ON [PRIMARY]GOI have an insert procedure that checks for duplicates before insertinga new record:IF (SELECT TOP 1 [ID] FROM tblRecords WHERE EmployeeNumber =@SocialSecurity) IS NULLBEGININSERT INTO tblRecords(EmployeeNumber,ArrivalTime)VALUES (@EmployeeNumber, @ArrivalTime)SELECT SCOPE_IDENTITY()ENDELSESELECT 0 AS DuplicateRecordIn 99.9% of the cases, this works well. However, in the event that theinsert attempts are literally "ticks" apart, the "SELECT TOP 1..."command completes on both attempts before the first attempt completes.So I end up with duplicate entries if the procedure is called multipletimes vey quickly. The system needs to prevent duplicateEmployeeNumbers within the past 45 days so setting the EmployeeNumberto UNIQUE would not work. I can check for older entries (45 days ornewer) very easily, but I do not know how to handle the times when theprocedure is called multiple times within milliseconds. Would aTRANSACTION with a duplicate check after the INSERT with a ROLLBACKwork in this case? Any help is greatly appreciated!-E
View Replies !
Conditional Insert - Duplicate Key Issue
I am in the process of migrating an old access database into a new SQL Server 2000 database with a modified structure. Tables: [Chapters][Worksite][Employers] I want to insert into the chapters table a ChapterID(PK), EmployerID(FK), and ChapterName. All of the selected information is coming from the [Worksite] table. However, my conditional is based on a third table, the [Employers] table. Below is a copy of a query that returns the result set I would like to insert into my [Chapters] table. Code: Select distinct a.WorksiteCode, b.employerID, a.WorksiteName From Worksite a, employers b Where a.worksiteCode = b.employerWSCode When I run this query it appears to return the proper result set. However, when I turn that query into an insert statement: Code: SET IDENTITY_INSERT Chapters ON Insert into Chapters (chapterID, employerID, chapterName) Select distinct a.WorksiteCode, b.employerID, a.WorksiteName From Worksite a, employers b Where a.worksiteCode = b.employerWSCode SET IDENTITY_INSERT Chapters OFF I recieve the following error message: Server: Msg 2627, Level 14, State 1, Procedure InsertChapterFromFixed, Line 10 Violation of PRIMARY KEY constraint 'PK_Chapters'. Cannot insert duplicate key in object 'Chapters'. The statement has been terminated. Anyone have any idea on how I can avoid this error message... either my distinct statement is not function as I expect it to, or I am doing something else wrong. Thanks for any help.
View Replies !
Insert That Drops Duplicate Records
I ought to know how to do this, but it escapes me at the moment. I need to write an insert statement for a table that will be based on a complex select query. The select query may return rows that are already in the target table. In that case, I don't want duplicates created, but I don't want the query to error, either. I can't remember how to set that up.
View Replies !
Cannot Insert Duplicate Key In Object 'dbo.RunningJobs'
I'm using SSRS 2005 on a Server 2003 machine. Some of my reports run fine but others take a long time to run and sometimes fail with an http error 503. After a report errror happens I find entries in the event log that says: cannot open a connection to the report server When I look at the log files for Reporting services I see an error caused by a primary key violation on the Running Jobs Table: Violation of PRIMARY KEY constraint 'PK_RunningJobs'. Cannot insert duplicate key in object 'dbo.RunningJobs' Does anyone know why do I get such errors? Bellow is the error message in the logs: w3wp!library!6!21/08/2006-09:30:22:: e ERROR: Throwing Microsoft.ReportingServices.Diagnostics.Utilities.ReportServerDatabaseUnavailableException: The report server cannot open a connection to the report server database. A connection to the database is required for all requests and processing., ; Info: Microsoft.ReportingServices.Diagnostics.Utilities.ReportServerDatabaseUnavailableException: The report server cannot open a connection to the report server database. A connection to the database is required for all requests and processing. ---> System.Data.SqlClient.SqlException: Violation of PRIMARY KEY constraint 'PK_RunningJobs'. Cannot insert duplicate key in object 'dbo.RunningJobs'. The statement has been terminated. at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection) at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj) at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj) at System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString) at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async) at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, DbAsyncResult result) at System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(DbAsyncResult result, String methodName, Boolean sendToPipe) at System.Data.SqlClient.SqlCommand.ExecuteNonQuery() at Microsoft.ReportingServices.Library.RunningJobsDb.AddRunningJobs(Hashtable runningJobs)
View Replies !
Cannot Insert Duplicate Key In Object 'dbo.RunningJobs'
We continue to recieve he following error on our RS 2005 SP1 Reporting Services installation: Violation of PRIMARY KEY constraint 'PK_RunningJobs'. Cannot insert duplicate key in object 'dbo.RunningJobs' This causes our server to become unresponsive and some reports to not render, Its becoming quite common. We reset IIS to correct it but is causes a service interuption. I know that it had been talked about before as something that may be fixed in SP2. But I do not see this referenced. Does anybody know of any fix for this? Thanks Ron
View Replies !
Duplicate Records Are Being Inserted With One Insert Command.
This is like the bug from hell. It is kind of hard to explain, soplease bear with me.Background Info: SQL Server 7.0, on an NT box, Active Server pageswith Javascript, using ADO objects.I'm inserting simple records into a table. But one insert command isplacing 2 or 3 records into the table. The 'extra' records, have thesame data as the previous insert incident, (except for the timestamp).Here is an example. Follow the values of the 'Search String' field:I inserted one record at a time, in the following order (And only oneinsert per item):airplanejetdogcatmousetigerAfter this, I should have had 6 records in the table. But, I endedup with 11!Here is what was recorded in the database:Vid DateTime Type ProductName SearchString NumResultscgcgGeorgeWeb3 Fri Sep 26 09:48:26 PDT 2003 i null airplane 112cgcgGeorgeWeb3 Fri Sep 26 09:49:37 PDT 2003 i null jet 52cgcgGeorgeWeb3 Fri Sep 26 09:50:00 PDT 2003 i null dog 49cgcgGeorgeWeb3 Fri Sep 26 09:50:00 PDT 2003 i null jet 52cgcgGeorgeWeb3 Fri Sep 26 09:50:00 PDT 2003 i null jet 52cgcgGeorgeWeb3 Fri Sep 26 09:50:22 PDT 2003 i null dog 49cgcgGeorgeWeb3 Fri Sep 26 09:50:22 PDT 2003 i null cat 75cgcgGeorgeWeb3 Fri Sep 26 09:52:53 PDT 2003 i null mouse 64cgcgGeorgeWeb3 Fri Sep 26 09:53:06 PDT 2003 i null tiger 14cgcgGeorgeWeb3 Fri Sep 26 09:53:06 PDT 2003 i null mouse 64cgcgGeorgeWeb3 Fri Sep 26 09:53:06 PDT 2003 i null mouse 64Look at the timestamps, and notice which ones are the same.I did one insert for 'dog' , but notice how 2 'jet' records wereinsertedat the same time. Then, when I inserted the 'cat' record, another'dog' record was inserted. I waited awhile, and inserted mouse, andonly the mouse was inserted. But soon after, I inserted 'tiger', and 2more mouse records were inserted.If I wait awhile between inserts, then no extra records are inserted.( Notice 'airplane', and the first 'mouse' entries. ) But if I insertrecords right after one another, then the second record insertion alsoinserts a record with data from the 1st insertion.Here is the complete function, in Javascript (The main code ofinterestmay start at the Query = "INSERT ... statement):----------------------------------------------------------------------//Write SearchTrack Record ------------------------------------Search.prototype.writeSearchTrackRec = function(){Response.Write ("<br>Calling function writeSearchTrack "); // fordebugvar Query;var vid;var type = "i"; // Type is imagevar Q = "', '";var datetime = "GETDATE()";//Get the Vid// First - try to get from the outVid var of Cookieinctry{vid = outVid;}catch(e){vid = Request.Cookies("CGIVid"); // Gets cookie id valuevid = ""+vid;if (vid == 'undefined' || vid == ""){vid = "ImageSearchNoVid";}}try{Query = "INSERT SearchTrack (Vid, Type, SearchString, DateTime,NumResults) ";Query += "VALUES ('"+vid+Q+type+Q+this.searchString+"',"+datetime+","+this.numResults+ ")";this.cmd.CommandText = Query;this.cmd.Execute();}catch(e){writeGenericErrLog("Insert SearchTrack failed", "Vid: "+vid+"- SearchString:: "+this.searchString+" - NumResults: "+this.numResults, e.description);}}//end-----------------------------------------------------------------I also wrote a non-object oriented function, and created the commandobject inside the function. But I had the same results.I know that the function is not getting called multiple timesbecause I print out a message each time it is called.This really stumps me. I'll really appreciate any help you canoffer.Thanks,George
View Replies !
Problem Of Duplicate Records With A Simple Insert Statement !
I am using a simple stored proc shown below which inserts a record and updates the same record field called SortID with the Primary Key Column data of the same record.Everything was working fine until few days back. The site has been deployed 2 years back and was LIVE ever since. We have got thousands of records in this Credits table. The table field called SortID is used for moving the credits up and down. My problem is now after 2 years of deploying the table has got duplicate records, suprisingly a same credit is appearing under different MemberID and with the same SortID. How are these duplicate records inserted with a simple insert statement & update ?? Is this a Locking problem or Transaction problem I have no idea. Any ideas will be of great help Thanks in Advance Stored Procedure Used CREATE PROC SP_SC_INSERT (@memberID int,@title varchar(30),@dir varchar(30),@desc varchar(20))ASINSERT INTO [dbo].[Credits]([MemberID],[Title],[Director], [Description], )VALUES(@memberID,@title,@dir, @desc, )UPDATE Credits Set SortID = @@IDENTITY WHERE CreditID = @@IDENTITYGO
View Replies !
Duplicate Last Record When Using SqlDataAdapter.Update For Insert Command
I'm getting duplicate records for the last record in the datatable. No matter how much or how little my datatable contains row records, it always duplicate the last one for some reason. Is there something wrong with my code below? EXAMID pulling from another stored procedure, which is outputed back to a variable. ---Data Access Layer---- If dt.Rows.Count > 0 Then 'INSERT EXAM ROSTERInsertComm = New SqlCommandsqladapter = New SqlDataAdapterInsertComm = New SqlClient.SqlCommand("ExamOfficers_AddOfficerSpecificExamRoster", conndb)InsertComm.CommandType = CommandType.StoredProcedure sqladapter.InsertCommand = InsertCommInsertComm.Parameters.Add("@examid", SqlDbType.Int)InsertComm.Parameters("@examid").Value = examidInsertComm.Parameters.Add("@officerid", SqlDbType.Int, 12, "Officer_UID")InsertComm.Parameters.Add("@reimburse", SqlDbType.Bit, 12, "ReimburseToDb")InsertComm.Parameters.Add("@posttest", SqlDbType.Int, 12, "Post_Test")InsertComm.Parameters.Add("@pqcdate", SqlDbType.DateTime, 12, "pqc_date")InsertComm.Parameters.Add("@pqcscore", SqlDbType.Int, 12, "pqc_score") conndb.Open() sqladapter.UpdateBatchSize = 100InsertComm.UpdatedRowSource = UpdateRowSource.Nonesqladapter.Update(dt) InsertComm.ExecuteNonQuery()InsertComm.Dispose() End If ----Stored Procedure---- ALTER PROCEDURE [dbo].[ExamOfficers_AddOfficerSpecificExamRoster] @ExamID as int,@OfficerID as int,@reimburse as bit=NULL,@posttest as int=NULL,@pqcdate as datetime=NULL,@pqcscore as int=NULL ASBEGIN SET NOCOUNT ON; Insert Into Exam_Officers(EXAM_UID,Officer_UID,reimburse,post_test,pqc_date,pqc_score)values(@ExamID,@OfficerID,@reimburse,@posttest,@pqcdate,@pqcscore) END
View Replies !
Duplicate Tables Insert/Update In Another Table? Triggers?
I want to be able to duplicate every single record that is inserted or updated in a particular table to another table, but not the delete. Is the best way to set-up a trigger? If so can anyone provide me with an example of how to do this? Also could you just duplicate certain columns in the row I would you have to do all columns? Thanks for help.
View Replies !
Insert From Formview And Checking Database To Avoid A Duplicate Entry
I have a form view that I am using to insert new data into a sql express database and would like to find a way to avoid attempting to insert a record if the key already exists. is there a way to do this with the formview insert command. Everything works great until I try to add a record with an already existing value in the unique key field, then it breaks.
View Replies !
Cannot Insert Duplicate Key Row In Object 'MSmerge_genhistory' With Unique Index 'unc1MSmerge_genhistory'
I have 1 client who keeps running into the following error on the subscriber and merge agents > €œCannot insert duplicate key row in object 'MSmerge_genhistory' with unique index 'unc1MSmerge_genhistory'.€? Last time we got this error I ran a reindex on table MSmerge_genhistory on the publisher database, I then successfully generated a new snapshot and the subscribers started to synchronize again. This time around I keep getting the error even after I follow these steps (I also ran all the jobs to clean up replication). The last time I ran into this error I created a job to reindex msmerge_genhistory on a nightly bases in an effort to avoid this problem. Can somebody please provide me with a workaround and also the reason why this error occurs in the first place. Thank you in advanced, Pauly C
View Replies !
Cannot Insert Duplicate Key Row In Object 'dbo.lastlogin' With Unique Index 'IX_lastlogin'.
Hi. I have been recently redesigning my tables - creating FK relationships from child tables to the PK userid in the Users table. The specifics of what I did and why can be seen here: http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=1968856&SiteID=1 But, now I am getting the below error: Cannot insert duplicate key row in object 'dbo.lastlogin' with unique index 'IX_lastlogin'. The statement has been terminated. Or, for that matter, SavedSearches or any other table where I need to insert the same userid twice. I can see why I would want to avoid duplicates in the Users table. But, for lastlogin, savedsearches, and a few of my other tables, the same user may account for multiple rows. Any suggestions as to where I messed up and how to deal with this? Thanks. DBO.USERS Code Snippet CREATE TABLE [dbo].[users]( [userid] [int] IDENTITY(1,1) NOT NULL, [lastname] [varchar](50) NULL, [firstname] [varchar](50) NULL, [email] [varchar](50) NOT NULL, [alternateemail] [varchar](50) NULL, [password] [varchar](50) NOT NULL, [role] [varchar](10) NOT NULL, [securityquestion] [varchar](50) NOT NULL, [securityanswer] [varchar](50) NOT NULL, [zipcode] [int] NOT NULL, [birthmonth] [tinyint] NOT NULL, [birthday] [tinyint] NOT NULL, [birthyear] [int] NOT NULL, [gender] [varchar](10) NULL, [city] [varchar](50) NULL, [state] [varchar](50) NULL, [country] [varchar](50) NULL, [registerdate] [datetime] NOT NULL, [editdate] [datetime] NULL, [confirmed] [bit] NULL CONSTRAINT [DF__Users__confirmed__4CC05EF3] DEFAULT ((0)), CONSTRAINT [PK_users] PRIMARY KEY CLUSTERED ( [userid] ASC )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY], CONSTRAINT [IX_email] UNIQUE NONCLUSTERED ( [email] ASC )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] ) ON [PRIMARY] GO SET ANSI_PADDING OFF /****** Object: Table [dbo].[lastlogin] Script Date: 08/22/2007 14:16:16 ******/ SET ANSI_NULLS ON DBO.SAVEDSEARCHES CREATE TABLE [dbo].[savedsearches]( [savedsearchesid] [int] IDENTITY(1,1) NOT NULL, [searchname] [varchar](50) NOT NULL, [userid] [int] NOT NULL, [date] [datetime] NULL, [isdefault] [bit] NULL, [gender] [char](10) NULL, [startyear] [varchar](50) NULL, [endyear] [varchar](50) NULL, [country] [varchar](50) NULL, [miles] [int] NULL, [pictures] [varchar](50) NULL, [postal] [int] NULL, [sort] [tinyint] NULL, [photostring] [varchar](50) NULL, [orderby] [tinyint] NULL, CONSTRAINT [PK_SavedSearches] PRIMARY KEY CLUSTERED ( [userid] ASC, [searchname] ASC )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] ) ON [PRIMARY] GO SET ANSI_PADDING OFF GO ALTER TABLE [dbo].[savedsearches] WITH NOCHECK ADD CONSTRAINT [FK_savedsearches_users] FOREIGN KEY([userid]) REFERENCES [dbo].[users] ([userid]) GO ALTER TABLE [dbo].[savedsearches] CHECK CONSTRAINT [FK_savedsearches_users] GO SET QUOTED_IDENTIFIER ON GO The following insert statement returned the error in the subject because userid = 32 already exists in the Users table. INSERT INTO lastlogin VALUES (32, CONVERT(VARCHAR(26), GETDATE(), 109), 1, CONVERT(VARCHAR(26), GETDATE(), 109)) DBO.LASTLOGIN Code Snippet CREATE TABLE [dbo].[lastlogin]( [lastloginid] [int] IDENTITY(1,1) NOT NULL, [userid] [int] NOT NULL, [date] [datetime] NOT NULL, [status] [bit] NOT NULL CONSTRAINT [DF_lastlogin_status] DEFAULT ((0)), [activity] [datetime] NOT NULL CONSTRAINT [DF_lastlogin_activity] DEFAULT (getutcdate()), [online] AS (case when [status]=(1) AND datediff(minute,[activity],getutcdate())<(30) then (1) else (0) end), CONSTRAINT [PK_lastlogin] PRIMARY KEY CLUSTERED ( [date] ASC, [userid] ASC )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] ) ON [PRIMARY] GO ALTER TABLE [dbo].[lastlogin] WITH NOCHECK ADD CONSTRAINT [FK_lastlogin_users] FOREIGN KEY([userid]) REFERENCES [dbo].[users] ([userid]) GO ALTER TABLE [dbo].[lastlogin] CHECK CONSTRAINT [FK_lastlogin_users]
View Replies !
[XML Task] Error: An Error Occurred With The Following Error Message: There Are Multiple Root Elements.
I'm trying to use an XML Task to do a simple XSLT operation, but it fails with this error message: [XML Task] Error: An error occurred with the following error message: "There are multiple root elements. Line 5, position 2.". The source XML file validates fine and I've successfully used it as the XML Source in a data flow task to load some SQL Server tables. It has very few line breaks, so the first 5 lines are pretty long: almost 4000 characters, including 34 start-tags, 19 end-tags, and 2 empty element tags. Here's the very beginning of it: <?xml version="1.0" encoding="UTF-8"?> <ESDU releaselevel="2006-02" createdate="26 May 2006"><package id="1" title="_standard" shorttitle="_standard" filename="pk_stan" supplementdate="01/05/2005" supplementlevel="1"><abstract><![CDATA[This package contains the standard ESDU Series.]]></abstract> There is only 1 ESDU root element and only 1 package element. Of course, the XSLT stylesheet is also an XML document in its own right. I specify it directly in the XML Task: <?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/> <xsl:template name="identity" match="@*|node()"> <xsl:copy> <xsl:apply-templates select="@*|node()"/> </xsl:copy> </xsl:template> <xsl:template match="kw"> <xsl:copy> <xsl:apply-templates select="@*"/> <xsl:attribute name="ihs_cats_seq" select="position()"/> <xsl:apply-templates select="node()"/> </xsl:copy> </xsl:template> </xsl:stylesheet> Its 5th line is the first xsl:template element. What is going on here? I do not see multiple root elements in either the XML document or the XSLT stylesheet. Thanks!
View Replies !
A Divide By Zero Was Attempted?
When i try and play a game the game loads and then a box come up that says "a divide by zero was attempted" and the inly thing i can do is click ok and it closes. How do i fix this so i can play the game?
View Replies !
Attempted To Divide By Zero
hi, i had this formula written for a textbox in a table, but yet still encounter the following error: expression: =iif(countdistinct(Fields!room.Value)=0,0, sum(Fields!rate.Value)/countdistinct(Fields!room.Value)) error: attempted to divide by zero. any way i can solve this problem? thanks!
View Replies !
Possible Attempted SQL Hack
I have SQL 2005 Express on a hosted webserver - the server is behind a provided firewall with port 1433 closed. In my event log I am getting hundreds of these : Login failed for user 'sa'. [CLIENT: 213.247.51.248] Event ID 18456 They come thick and fast from the same IP. When I look in SQL Error Logs it's State 8 which seems to be invalid password - so it looks like someone probing the server to me. I can see a way in the firewall to block certain IP's. Anyone know a way I can lockdown the SQL, or the server (Packet Filtering?) to stop this? The server is hosted by 1&1 who aren't that hot with support on stuff like this. Any help greatly appreciated!!
View Replies !
Cannot Insert Duplicate Key Row In Object 'dbo.blabla..' With Unique Index 'Idx_blablabl'. The Statement Has Been Terminated. At
We are developing a project that is expected to hold TB of data and the back end used is SQL Server 2005. I have the following problem I have applied Nonclustered index over a column on a table. Designed a SP for insertion which caters for updation incase the criteria based on the input is met. The logic goes like this Incase there exists a row containing the value of the column that is indexed for uniqueness, there should be updation. If not there should be a new row created. However often there is an error message that is placed above. This happens only on some of the SPs and only on rare occasions. Can any body tell me if there is any problem with the SQL Server 2005 Thanks in advance R Suresh, SQLDBA
View Replies !
|