Can A DTS Function Update The Transaction Log
I have an application which uses DTS to import data. After the data is imported the transaction logs are no good since the import wasn't logging.
Is there a way to turn logging on?
Thanks
View Complete Forum Thread with Replies
Related Forum Messages:
Update Function: Why SQL Server Update An Empty String With 0?
I'm new to this forum. This 'problem' has occured many times, but I've always found a way around it. I have pages with datagrids, in which a user can edit a certain fields and then update the tables with new data. Lets say when a user edit a Name field and a money field. If he/she left those two fields blank, the table is automatically updated with a <null> (for the name field) and a 0 (for the money field.) Both these columns were set up to allow Null values. Anyone has an idea why they were updated that way? And is there like a standard on how the data types are updated if a field is left blank? Thank you very much.
View Replies !
Split Function In A Transaction
I have some sql results coming out as a string when it is a bunch of numbers separated with a coma. (1,2,3). I need to insert this figures as separate numbers in separate rows into a table in a database. How do I split them and how do I input them. I tried using a loop and it works well in an asp page but I need to do that in sql. JG
View Replies !
Insert Stored Procedure With Error Check And Transaction Function
Hi, guys I try to add some error check and transaction and rollback function on my insert stored procedure but I have an error "Error converting data type varchar to smalldatatime" if i don't use /*error check*/ code, everything went well and insert a row into contract table. could you correct my code, if you know what is the problem? thanks My contract table DDL: ************************************************** *** create table contract( contractNum int identity(1,1) primary key, contractDate smalldatetime not null, tuition money not null, studentId char(4) not null foreign key references student (studentId), contactId int not null foreign key references contact (contactId) ); My insert stored procedure is: ************************************************** ***** create proc sp_insert_new_contract ( @contractDate[smalldatetime], @tuition [money], @studentId[char](4), @contactId[int]) as if not exists (select studentid from student where studentid = @studentId) begin print 'studentid is not a valid id' return -1 end if not exists (select contactId from contact where contactId = @contactId) begin print 'contactid is not a valid id' return -1 end begin transaction insert into contract ([contractDate], [tuition], [studentId], [contactId]) values (@contractDate, @tuition, @studentId, @contactId) /*Error Check */ if @@error !=0 or @@rowcount !=1 begin rollback transaction print ‘Insert is failed’ return -1 end print ’New contract has been added’ commit transaction return 0 go
View Replies !
Transaction On Update
I have a simple update: begin transaction update table1 set column1 = 10 where column2 = 'ABC' If @@Error > 0 then rollback transaction else commit transaction print 'show all updated fields' go What i want to achieve is if transaction is successful, i would like to see which fields were updated (in form of report or something like following below: column0 | column1 | column2 --------------------------- 1 | 10 | ABC 21 | 10 | ABC 12 | 10 | ABC 251 | 10 | ABC 4 row(s) updated. There should be a clause like OUTPUT, but don't know how to use it :-( thank you
View Replies !
How To Update Using A Function
Take a table, where not all the columns are populated:CREATE TABLE #T (A int, B int, C int, D int)INSERT #T (A,B) VALUES (1,2)INSERT #T (A,B) VALUES (3,4)INSERT #T (A,B) VALUES (5,6)INSERT #T (A,B) VALUES (7,8)INSERT #T (A,B) VALUES (9,10)The values for C and D can be computed as functions of A and B. For thisexample, let's say they are twice A and three times B, respectively:CREATE FUNCTION dbo.F(@A int,@B int)RETURNS @Tbl TABLE (X int, Y int)AS BEGININSERT @Tbl (X,Y) VALUES (@A*2, @B*3)RETURNENDNow we use the function to compute the other columns:UPDATE #T SET C=X, D=YFROM dbo.F(A,B)Right? Well, no. Instead, I get this message:Server: Msg 155, Level 15, State 1, Line 2'A' is not a recognized OPTIMIZER LOCK HINTS option.Any suggestions? I would like to use this structure, if possible.Jim GeissmanCountrywide Home Loans
View Replies !
UPDATE From A Function In CLR
I have been trying to get a function to UPDATE a row in the database. I know that this is not supported but by using code from a previous post this can be accomplished [See my code below]. http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=1863258&SiteID=1 Code Snippet [SqlFunction(DataAccess = DataAccessKind.Read)] public static int GetNextValue(string dbName) { int rows = 0; lock (obj) { SqlPipe sp = SqlContext.Pipe; using (SqlConnection conn = new SqlConnection("context connection=true")) { SqlCommand cmd = new SqlCommand("SELECT id FROM Items", conn); conn.Open(); rows = int.Parse(cmd.ExecuteScalar().ToString()) + 1; using (SqlConnection updateCon = new SqlConnection("Data Source=" + Environment.MachineName + ";Initial Catalog=" + dbName + ";Integrated Security=True;Pooling=False")) { SqlCommand updateCmd = new SqlCommand("UPDATE Items SET id=" + rows,updateCon); updateCon.Open(); updateCmd.ExecuteScalar(); updateCmd.Dispose(); } return rows; } } I hope this is helpful. Regards tribal
View Replies !
Using Transaction Log To Update Another Database
I am doing some replication setup in test environment. Will it be possibleto use the transaction log from a production server to update the testserver? Any reference to any document will also be appreciated.I know I have to restore most recent backup from the production server tothe test server. and all the transactions after the backup on the productionserver has to be run on the test server.Thanks for your reply.-Mokles
View Replies !
DTC ... Distributed Transaction Update.... Help
Hello. I am trying to update a table on another server which is configured as a linked server on the server issueing the update. I can select data from the linked server no problem. But when I issue the update statement within the begin distributed tranaction I get the following. I am getting the following message Server: Msg 7392, Level 16, State 2, Line 1 Could not start a transaction for OLE DB provider 'SQLOLEDB'. [OLE/DB provider returned message: Cannot start more transactions on this session.] Has anyone had any similar problems with DTC.... I am getting ready to call Microsoft. But wanted to avoid the charge. Thanks John
View Replies !
C# Update Function. Where AND Where Not Working.
Can someone please tell me why in the bloody hell this isnt working? It ignores the WHERE VENDORID match portion and marks all instances of USERID match to TRUE. I've been banging my head for an hour... have I really forgotten basic sql???!!!!public static void UpdateVendor(VendorEvaluationEntity VEE) {int vendorid = Convert.ToInt32(VEE.VendorevalVendor); int userid = Convert.ToInt32(VEE.VendorevalUser);SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["VendorEvaluationConnectionString"].ConnectionString); SqlCommand cmd = new SqlCommand("Update tblVendorUser set vendoruser_vendor_evaluated = 'true' where (vendoruser_vendor_id = @vendorid) and (vendoruser_user_id=@userid)", conn);SqlParameter pmvendorid = new SqlParameter(); SqlParameter pmuserid = new SqlParameter();pmvendorid.ParameterName = "@vendorid";pmvendorid.SqlDbType = SqlDbType.Int; pmvendorid.Value = vendorid; pmuserid.ParameterName = "@userid";pmuserid.SqlDbType = SqlDbType.Int; pmuserid.Value = userid; cmd.Parameters.Add(pmvendorid); cmd.Parameters.Add(pmuserid); conn.Open(); cmd.ExecuteNonQuery(); conn.Close(); }
View Replies !
How To Update A Table With SUM Function?
Table test2 has multiple amounts for each account, I would like to sumthe amounts for the same account and use the result to update thevariable 'tot_amount' in table test1. But SQL does not allow me to usesum function in update. Is there any other way to do this? Thanks.update test1set tot_amount=sum(b.amount)from test1 as ajoin test2 as bon a.acc_no=b.acc_no
View Replies !
Column Update Function
This is probably a common problem with a standard design pattern, butI'm having trouble finding the solution.I have a table with a lot of columns, for this example I'll just usethree but in reality its more like 20.Create Table myTable (int col_one primary key, int col_two,varchar(20) col_three) etc...I want to write a sproc that allows updating of this column. Say Ihave a sproccreate sproc myUpdate int @col_one, int @col_two, varchar(20)col_threeasupdate myTable col_two = @col_two, col_three = @col_threewhere col_one = @col_onethen if I only want to update col_two I have to pass in the currentvalue of col_three so that it remains the same, which seems prettyinefficient. so I could change it to:asupdate myTable col_two = coalasce(@col_two, col_two), col_three = coalasce(@col_three, col_three)where col_one = @col_oneand then if I wanted to leave col_three the way it is then I couldjust doexec myUpdate 1, 2, NULLthe only problem here is that what if the value of col_three iscurrently 3, and I want to set it to NULL? Under the current method,setting someting to NULL is impossiblefinally, I'd like to use parameter naming in my exec calls. that wayI can just say someting likeexec myUpdate 1, col_three=3this would update col_three to 3 and leave the rest of the fieldsuntouched. you can see how handy this would be if you just want tochange a few of the fields in a table with a large number of columns.I'm sure this has been done before, can somebody point me in the rightdirection?Thanks,Ben
View Replies !
Aggregate Function Update
I am trying to write an update statement based on an aggregate and it will not let me. Please find below the SQL. update abtimesummary set hours = sum(a.hours) from abtimestore a join abtimesummary b on (cast(a.weekno as varchar(10)))+'-'+(cast(a.empno as varchar(10))) = b.summaryid and this is the error message: Server: Msg 157, Level 15, State 1, Line 2 An aggregate may not appear in the set list of an UPDATE statement. Can someone tell me how to get round this please? Many thanks
View Replies !
Trigger And Update() Function!
In the SQL 7.0 Documentation is indicated that the UPDATE(<fieldname>), if used in a isert/update trigger, it return TRUE or FALSE based on presence of <field> in the SET List, if the trigger was fired by an UPDATE operation, or in the list of field to fill, if the trigger was fired by an INSERT operation. Below there is a piece of code that demostrate the false documentation assertion in the case of a trigger fired by an INSERT operation, infact even if i have specified only the FIELD1 in INSERT Statement the trigger Print in the screen that i have touched FIELD2 too. Now the SP1 don't solve this BUG, even if i had read some month ago (before that SP1 was out) that in SP1 this will be fixed! Anyone Can Help me to solve this problem, indicating me where i can post the problem to sensitize the Microsoft's Service Pack Factory ? Thank in Advance PS:Sorry for my Bad English .... correct me please if some part are not readable! ------[Cut Here]------------------- CREATE TABLE TEST (FIELD1 INTEGER , FIELD2 INTEGER ) GO CREATE TRIGGER TriggerIU_Test ON TEST FOR INSERT, UPDATE AS IF UPDATE(FIELD1) PRINT 'Field 1 Touched' IF UPDATE(FIELD2) PRINT 'Field 2 Touched' GO print 'InsertIng ' INSERT INTO TEST (FIELD1) VALUES (2) print 'Updating ' UPDATE TEST set FIELD1 = 1 GO DROP TABLE TEST ------[Cut Here]-------------------
View Replies !
Urgent : Update() Function
IF OBJECT_ID('dbo.TestTrigger') IS NOT NULL BEGIN DROP TABLE dbo.TestTrigger IF OBJECT_ID('dbo.TestTrigger') IS NOT NULL PRINT '<<< FAILED DROPPING TABLE dbo.TestTrigger >>>' ELSE PRINT '<<< DROPPED TABLE dbo.TestTrigger >>>' END go CREATE TABLE dbo.TestTrigger ( colA int NULL, colB int NULL ) go IF OBJECT_ID('dbo.TestTrigger') IS NOT NULL PRINT '<<< CREATED TABLE dbo.TestTrigger >>>' ELSE PRINT '<<< FAILED CREATING TABLE dbo.TestTrigger >>>' go IF OBJECT_ID('dbo.TestTrigger_i') IS NOT NULL BEGIN DROP TRIGGER dbo.TestTrigger_i IF OBJECT_ID('dbo.TestTrigger_i') IS NOT NULL PRINT '<<< FAILED DROPPING TRIGGER dbo.TestTrigger_i >>>' ELSE PRINT '<<< DROPPED TRIGGER dbo.TestTrigger_i >>>' END go CREATE TRIGGER dbo.TestTrigger_i ON dbo.TestTrigger FOR INSERT AS IF UPDATE(colA) select "updating col A" IF UPDATE(colB) select "updating col B" go go IF OBJECT_ID('dbo.TestTrigger_i') IS NOT NULL PRINT '<<< CREATED TRIGGER dbo.TestTrigger_i >>>' ELSE PRINT '<<< FAILED CREATING TRIGGER dbo.TestTrigger_i >>>' go insert into TestTrigger (colA) values (1) go insert into TestTrigger (colA, colB) values (2,3) go
View Replies !
Update Function Does Not Work Using ADO
Hi friends, Pls help me out!!!!! table does not have any record. I create a recordset and then I do rset->update() it works for the first time. Id = unique number name= john last name= garisson but now I would like to update it with the same id but name and last name are differenet. it goes into exception at this statement. rset->update() exception log 'The changes you requested to the table were not successful because they would create duplicate values in the index, primary key, or relationship. Change the data in the field or fields that contain duplicate data, remove the index, or redefine the index to permit duplicate entries and try again.', Kindly, help me out.
View Replies !
Problem In Update Due To Transaction Presence.
Hi, Good morning to all. I'm facing the following problem. Can anyone please help me!...When a transaction is open, the database is getting locked for other user to fetch the records from database.I have to update multiple database table with huge data (Lac). So the transaction will be open for longer period. Mean while if somebody tries to fetch or do select query it give timeout exception. And it does not function until the transaction is closed.How to avoid this database locking for other users. Below is the code that i have used: using (DbConnection dbconn = base.db.CreateConnection()) { dbconn.Open(); DbTransaction dbtran = dbconn.BeginTransaction(); try { Here inserting, updating to multiple table will be happening dbtran.Commit(); } catch (SqlException ex) { dbtran.Rollback(); } finally { dbconn.Close(); } } Thanks in advance... :) Regards,Ashok kumar.
View Replies !
UPDATE Another Table Using Aggregate Function
Here is the example: I have two tables. One has Projects with the total amt of hours worked on the project itself. The other is an Employee_Projects table with individual rows of hrs per employee worked on the above referenced projects. I need to SUM all the hrs from the Employee_Projects table and GROUP BY project number, then UPDATE the Projects table with the sum of hours where the Project Number from table A matches the Project Number from table B. Of course, you cant use an aggregate function in an UPDATE clause, so what would be the easiest way to do this?? Any help would be much appreciated. -C
View Replies !
Update Using Group By And Aggregate Function
I'm trying to update a varchar field using SUM. I keep getting the error that the sub query returns more than one value. UPDATE CIRSUB_M SET TRM_DMO = SUBSTRING(TRM_DMO,1,11) + (SELECT CAST(SUM(COPIES) AS VARCHAR(5)) FROM CIRSUB_M WHERE BIL_ORG = '02' AND CRC_STS IN ('R','P','Q','T') GROUP BY PUB_CDE, DNR_NBR) WHERE BIL_ORG = '02' AND CRC_STS IN ('R','P','Q','T') Example PUB_CDE DNR_NBR COPIES TRM_DMO THN 000000092637 100 A THN 000000092637 200 B THN 000000082455 100 A THN 000000082455 200 B THN 000000051779 100 A Updated THN 000000092637 100 A300 THN 000000092637 200 B300 THN 000000082455 100 A300 THN 000000082455 200 B300 THN 000000051779 100 A100
View Replies !
Exec Sproc In A Update Function
Folks Here is a query which updates certain values. GetAddress is another sproc which returns addrId. I have to pass certain values ie strAddress1 strCity .....intZip4 values in the sproc GetAddress and execute the update query. In doing so it says GetAddress in not a recognized function name. Is the syntax correct to exec sproc GetAddress. update Persons set Persons.strLastName=H.strLastName, Persons.strNameSuffix=H.strNameSuffix, Persons.lngHomeID= GetAddress (H.strAddress1,strAddress2,H.strCity,H.strState,H. strZip,H.intZip4), Persons.lngMailID= GetAddress(H.strAddress1,strAddress2,H.strCity,H.s trState,H.strZip,H.intZip4) from ALSHeadr H where Persons.lngSSN=H.lngFedTaxID FYI I can post GetAddress sproc but it is working properl. I just want to know how to pass the values in ALSHeadr table into the sproc. Thanx
View Replies !
IF UPDATE() Function And Text Fields
I'm using IF UPDATE() function in the update trigger. the problem is -- that bloody function evaluates to true all the bloody time for a text field, even if text field is not present in the update clause. (I'm using SQL Server 6.5 with SP5a) microsoft article about "IF UPDATE() functionality is broken in service pack 5, 5a" applies only to insert triggers.... any ideas? suggestions? am I crazy? thanks in advance. Gregory
View Replies !
UPDATE RECORDS WITH AGGREGATE FUNCTION
Problem is very simple I want to update sum of a field from another table to first table TABLE ONE: ========== ItemID QtyInStock Table TWO: ========== BatchID ItemID Qty I want to Update the QtyInStock of First Table with Sum(Batch.Qty) here is the query i am writing but giving error UPDATE ITEMS SET INSTOCKQTY=CASE WHEN QtyInBatch>1 THEN QTYINBATCH ELSE 0 END FROM ITEMS, ( SELECT ITEMS.ITEMID, SUM(Batch.Qty) AS QtyInBatch FROM Batch INNER JOIN Items ON Batch.ItemID = Items.ItemID GROUP BY ITEMS.ITEMID ) appericiating anyones help in advance FAZEEL AMJAD Systems Engineer Crystal Technologies
View Replies !
ADO.NET Transaction Fails To Update Database After .Commit()
SQL Server 2000, C#, ASP.NET and ADO.NET. I have searched for 3 days trying to figure out why my ADO.NET Transaction executes my stored procedures and runs the .COMMIT() on the server, figured this out by using the SQL Profiler, but the data doesn't show up in the database tables and I recieve no error from SQL or ASP.NET. What gives???? Anyone else ever heard of such a thing. Please help, before I loose my sanity.
View Replies !
Update Table With Joins And Aggregate Function
Is this possible? What I am looking for is something like:UPDATE T_SitesSET T_Sites.LastDate = T_Inspections.DateFROM T_SitesINNER JOIN T_Assets ON T_Sites.SiteID = T_Assets.AssetIDLEFT OUTER JOIN T_Insecptions ON T_Assets.AssetID = T_Inspections.AssetID-- But I need only the last inspection done on the site (including if it is null)
View Replies !
SP5 Problem For Insert Trigger Update Function
In recent testing, I have found that the trigger function UPDATE under SQL Server 6.5 SP5 behaves differently then SP4. For insert, the update function returns true on items that have not been explicitly inserted. Is this a bug? Is this a new feature change? Where can I get more information on a bug list for SP5?
View Replies !
Distributed Transaction Coordinator UPDATE Then COMMIT Then ROLLBACK
Hello, I am running the following from New Query in SQL Server 2005 management studio in an SQL Server 2005 instance on a separate machine. I am updating a SQL Server 2000 database on a separate machine. I execute each statement one at a time. SET XACT_ABORT ON BEGIN DISTRIBUTED TRANSACTION SELECT @@TRANCOUNT SELECT RIGHT(StudentID,LEN(StudentID)-LEN('TE2_')) FROM [HQ-A4].TI_excentonlineDD.dbo.Student SELECT * FROM [HQ-A4].TI_excentonlineDD.dbo.Student UPDATE [HQ-A4].TI_excentonlineDD.dbo.Student SET StudentID = RIGHT(StudentID,LEN(StudentID)-LEN('TE2_')) WHERE StudentID LIKE 'TE2_%' SELECT * FROM [HQ-A4].TI_excentonlineDD.dbo.Student SELECT @@TRANCOUNT COMMIT TRANSACTION SET XACT_ABORT OFF The update statement, updates an SQL Server 2000 database. The query will run for 30 seconds. I test the results with SELECT * FROM [HQ-A4].TI_excentonlineDD.dbo.Student then COMMIT TRANSACTION. All is good. After the COMMIT TRANSACTION, I check my new expected dataset expected results by SELECT * FROM [HQ-A4].TI_excentonlineDD.dbo.Student. Next, I open SQL Server 2000 query analyzer (another session (should show only COMMITED data) and connect to the target SQL Server 2000 database. I run SELECT * FROM TI_excentonlineDD. I get my new expected dataset expected results. All is good. I close Query Analyzer. I close the SQL Server 2005 Management Studio. The weird problem ------------------------- If I wait 5 minutes or so, open a new New Query or Query Analyzer, then, next, run SELECT * FROM [HQ-A4].TI_excentonlineDD.dbo.Student or run SELECT * FROM TI_excentonlineDD.dbo.Student, I get back my "old dataset re-appears" (my pre-COMMITED data). This is bad. I have repeated that same scenaro with both BEGIN DISTRIBUTED TRANSACTION and just BEGIN TRANSACTION After a while, the "old dataset re-appears" problem still happens. This is all bad. Is some sort of internal-crash or timeout failure occurring? Any ideas where I could start looking to resolve this problem? Thanks. AIMDBA
View Replies !
Should Insert, Update And Delete Stored Procs Be Wrapped In Transaction?????
I have looked at the membership and roles stored procs from Microsoft and noticed that most of them are wrapped into a transaction. Ok some of the stored procs updated more than one table in which case it makes sense to wrap the code into a transaction. Our stored procs are a little simpler and insert, update or delete only one table for the most part. My question is: What is good practice, should I wrap my stored procs in transactions or because I am only updating one table leave it the way it is, see sample below: Please advise, newbie ALTER PROCEDURE [dbo].[syl_Category_Insert] @CategoryName nvarchar(64), @LanguageID int AS BEGIN -- SET NOCOUNT ON added to prevent extra result sets from -- interfering with SELECT statements. SET NOCOUNT ON; BEGIN TRYINSERT INTO [syl_Categories] VALUES( @CategoryName, @LanguageID) SELECT SCOPE_IDENTITY() AS [CategoryID] RETURNEND TRY BEGIN CATCH --Execute LogError_Insert SP EXECUTE [dbo].[syl_LogError_Insert]; --Being in a Catch Block indicates failure. --Force RETURN to -1 for consistency (other return values are generated, such as -6).RETURN -1 END CATCH END
View Replies !
How To Manage Stored Procedure Transaction Involving Update In Several Tables
I am running a vba procedure ( adp file ) that executes successively 5 stored procedures . however it happens that the execution breaks at the middle of the code thus giving a situation where only 2 tables among 5 are updated. Is it any solution to rollback transactions update already done before the code breaks due to error ? I was thinking about combining all stored proc on a big one and use Begin transaction - commit transaction and rollback transaction ... however i am not sure wheter updates involving several tables can be handled on one transaction. Any advise highly appreciated !
View Replies !
Should Insert, Update And Delete Stored Procs Be Wrapped In Transaction?????
I have looked at the membership and roles stored procs from Microsoft and noticed that most of them are wrapped into a transaction. Ok some of the stored procs updated more than one table in which case it makes sense to wrap the code into a transaction. Our stored procs are a little simpler and insert, update or delete only one table for the most part. My question is: What is good practice, should I wrap my stored procs in transactions or because I am only updating one table leave it the way it is, see sample below: Please advise, newbie ALTER PROCEDURE [dbo].[syl_Category_Insert] @CategoryName nvarchar(64), @LanguageID int AS BEGIN -- SET NOCOUNT ON added to prevent extra result sets from -- interfering with SELECT statements. SET NOCOUNT ON; BEGIN TRY INSERT INTO [syl_Categories] VALUES( @CategoryName, @LanguageID) SELECT SCOPE_IDENTITY() AS [CategoryID] RETURN END TRY BEGIN CATCH --Execute LogError_Insert SP EXECUTE [dbo].[syl_LogError_Insert]; --Being in a Catch Block indicates failure. --Force RETURN to -1 for consistency (other return values are generated, such as -6). RETURN -1 END CATCH END
View Replies !
SQL To Oracle Update Trigger Fails Due To Distributed Transaction Error 7391
Hi,I am having a hard time creating a Trigger to update an Oracledatabase. I am using a SQL Server 2005 Express database on a Win XP ProSP2 desktop, linked to an Oracle 10g database on a remote Windows 2003server. Both machines are on the same domain and very close physically(<1ms ping).I have set up the Oracle linked server in SQLEXPRESS, added thelogin/pw information, and I can execute select and update queriessuccessfully using both four-part naming and OPENQUERY.Here is the actual trigger that I created:USE [AdventureWorks]GOSET ANSI_NULLS ONGOSET QUOTED_IDENTIFIER ONGOCREATE TRIGGER [MyTrigger]ON [Person].[Contact]AFTER UPDATEASBEGIN DISTRIBUTED TRANSACTIONSELECT * from oradb..schema.tableWHERE username = 'user'COMMIT TRANHowever, when I update a row in AdventureWorks.Person.Contact, there isa lag of about 2 seconds, and then I receive an error 7391 with thefollowing message: "The operation could not be performed because OLE DBprovider 'MSDAORA' for linked server 'oradb' was unable to begin adistributed transaction."Now, when I remove the "BEGIN DISTRIBUTED TRANSACTION" and "COMMITTRAN" from the trigger, I can update the row without any delay or errormessage.(Don't pay attention to the fact that the triggered action is a SELECTstatement. It also fails with an UPDATE statement, whether or not I use"BEGIN DISTRIBUTED TRANSACTION." I thought using the SELECT statementillustrates the problem more clearly.)If I replace the triggered code with an update to a SQL Server databaseon that same server (even using "BEGIN DISTRIBUTED TRANSACTION"), thenit works correctly. This leads me to believe that MS DTC is configuredproperly on both machines. There is no firewall between the twomachines, and I can Telnet from the desktop to the database server onport 135.I have gone through many MSKB articles (280106, 839279, 329332, 259959,193893, "Troubleshooting Oracle Publishers" from BOL), and archivednewsgroup posts but have been unable to find any resolution for thisproblem. I would appreciate any assistance you may provide.Best regards,George
View Replies !
Error 8525: Distributed Transaction Completed. Either Enlist This Session In A New Transaction Or The NULL Transaction.
Hi All I'm getting this when executing the code below. Going from W2K/SQL2k SP4 to XP/SQL2k SP4 over a dial-up link. If I take away the begin tran and commit it works, but of course, if one statement fails I want a rollback. I'm executing this from a Delphi app, but I get the same from Qry Analyser. I've tried both with and without the Set XACT . . ., and also tried with Set Implicit_Transactions off. set XACT_ABORT ON Begin distributed Tran update OPENDATASOURCE('SQLOLEDB','Data Source=10.10.10.171;User ID=*****;Password=****').TRANSFERSTN.TSADMIN.TRANSACTIONMAIN set REPFLAG = 0 where REPFLAG = 1 update TSADMIN.TRANSACTIONMAIN set REPFLAG = 0 where REPFLAG = 1 and DONE = 1 update OPENDATASOURCE('SQLOLEDB','Data Source=10.10.10.171;User ID=*****;Password=****').TRANSFERSTN.TSADMIN.WBENTRY set REPFLAG = 0 where REPFLAG = 1 update TSADMIN.WBENTRY set REPFLAG = 0 where REPFLAG = 1 update OPENDATASOURCE('SQLOLEDB','Data Source=10.10.10.171;User ID=*****;Password=****').TRANSFERSTN.TSADMIN.FIXED set REPFLAG = 0 where REPFLAG = 1 update TSADMIN.FIXED set REPFLAG = 0 where REPFLAG = 1 update OPENDATASOURCE('SQLOLEDB','Data Source=10.10.10.171;User ID=*****;Password=****').TRANSFERSTN.TSADMIN.ALTCHARGE set REPFLAG = 0 where REPFLAG = 1 update TSADMIN.ALTCHARGE set REPFLAG = 0 where REPFLAG = 1 update OPENDATASOURCE('SQLOLEDB','Data Source=10.10.10.171;User ID=*****;Password=****').TRANSFERSTN.TSADMIN.TSAUDIT set REPFLAG = 0 where REPFLAG = 1 update TSADMIN.TSAUDIT set REPFLAG = 0 where REPFLAG = 1 COMMIT TRAN It's got me stumped, so any ideas gratefully received.Thx
View Replies !
SSIS, Distributed Transaction Completed. Either Enlist This Session In A New Transaction Or The NULL Transaction.
I have a design a SSIS Package for ETL Process. In my package i have to read the data from the tables and then insert into the another table of same structure. for reading the data i have write the Dynamic TSQL based on some condition and based on that it is using 25 different function to populate the data into different 25 column. Tsql returning correct data and is working fine in Enterprise manager. But in my SSIS package it show me time out ERROR. I have increase and decrease the time to catch the error but it is still there i have tried to set 0 for commandout Properties. if i'm using the 0 for commandtime out then i'm getting the Distributed transaction completed. Either enlist this session in a new transaction or the NULL transaction. and Failed to open a fastload rowset for "[dbo].[P@@#$%$%%%]". Check that the object exists in the database. Please help me it's very urgent.
View Replies !
Distributed Transaction Completed. Either Enlist This Session In A New Transaction Or The NULL Transaction.
Hi all, I've already read the thread by the same topic, but I found Kevin Yu's comment a bit confusing. I don't know how to solve my problem. I have two stored procedures in sql server. First one inserts into a bunch of tables so it has Begin Transaction and Commit in it. Second one just inserts into one table so it doesn't have the begin transaction statement in it. From my data access class in c#.net, I have a function which calls both of these stored procedures from within a "using transactionscope" block. So when it makes the call to the first stored procedure, it returns fine, but when it calls the second one, I get the above error. I think it has something to do with me declaring transactionscope in my application code, and then calling a stored procedure which also has its own begin transaction. But I don't know how to fix this. Any ideas? Thanks
View Replies !
Distributed Transaction Completed. Either Enlist This Session In A New Transaction Or The NULL Transaction
I'm using TransactionScope object and it is giving me problems. The situation is like this. I've 2 tables in sql server express, say student and courses and other one studentcourse for courses a student has opted for. An aspx page displays list of users in listbox, when user chooses student, it fetches courses he has opted for and in the checkedlistbox (for courses) these courses are checked. Now when uses makes any changes to courses and clicks update button, i've two functions at backend first one removes the courses which were previously selected but now not selected in postback, next it inserts courses which was not selected first but now are in this postback. I use following code: protected void Update(object sender, EventArgs e) { /* get selections, existing courses etc. */ using(TransactionScope tscope=new TransactionScope()) { try { RemoveCourses(/*Student*/ s, /*IList*/ oldCourses, /*IList*/ newCourses); AddCourses(/*Student*/ s, /*IList*/ oldCourses, /*IList*/ newCourses); tscope.Complete(); } catch(Exception ex) { lblMessage.Text=ex.Message; } } } If any exception occurs during update and page is reload or I go to any other page where some data is fetched from sql server I get the exception: Distributed transaction completed. Either enlist this session in a new transaction or the NULL transaction Please help!
View Replies !
Distributed Transaction Completed. Either Enlist This Session In A New Transaction Or The NULL Transaction.
I am getting this error :Distributed transaction completed. Either enlist this session in a new transaction or the NULL transaction. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.Data.OleDb.OleDbException: Distributed transaction completed. Either enlist this session in a new transaction or the NULL transaction.have anybody idea?!
View Replies !
Default Date(current Date) Function W/ Update?
I have a reference table that currently has no web front-end. It's a small table(<10 rows) that's not going to change very often (maybe once every few months). We manually update rows on the table via the GUI table interface in Enterprise Mgr., not in T-SQL. What I'd like to do is have SQL Server automatically update the "Last_Modified" column with the current timestamp. I can do it on an Insert using the GetDate() function, but if I update a row, this doesn't work. Is there a function I can use that can auto-populate for both insert and updates?
View Replies !
TRANSACTIONS In SSIS (error: The ROLLBACK TRANSACTION Request Has No Corresponding BEGIN TRANSACTION.&&"
I'm receiving the below error when trying to implement Execute SQL Task. "The ROLLBACK TRANSACTION request has no corresponding BEGIN TRANSACTION." This error also happens on COMMIT as well and there is a preceding Execute SQL Task with BEGIN TRANSACTION tranname WITH MARK 'tran' I know I can change the transaction option property from "supported" to "required" however I want to mark the transaction. I was copying the way Import/Export Wizard does it however I'm unable to figure out why it works and why mine doesn't work. Anyone know of the reason?
View Replies !
Unable To Shrink Transaction Log Under Transaction Replication With Sync With Backup Enabled On Distribution Db?
We have applied transaction replication servers with SQLServer2005 standard edition with SP1 running on them. Sync with backup is also enabled on distribution db. Now our transaction log is not shrinking using standard shrinking procedure(taking log backup with truncate option/shrinkfile). select name,log_reuse_wait, log_reuse_wait_desc from sys.databases it is showing dbname, 6, Replication respectively. declare @db int set @db=db_id('dbname') dbcc loginfo(@db) is showing 2 in status column. tried shrinking transaction file after removing sync with backup option from distribution db. still it failed. again tried shrinking after stopping log reader, it didn't worked. Regards, M. Abdullah Idris
View Replies !
Retrieving Result Set From Dynamically Called Stored Procedure Or Function In A Function
Is there any way I can retrieve the result set of a Stored Procedurein a function.ALTER FUNCTION dbo.fn_GroupDeviceLink(@groupID numeric)RETURNS @groupDeviceLink TABLE (GroupID numeric, DeviceID numeric)ASBEGINDeclare @command nvarchar(255)SELECT @command = Condition// @command is an SQL string or stored procedue nameFROM DeviceGroupWHERE GroupID = @groupIDINSERT @groupDeviceLinkEXEC @commandRETURNENDIs there any way i can do anything like this. @command is a variableholding the name of a stored produre. I need to run that storedprocure and return the values in such a way that they can be used in aSELECT StatementMy goal is SELECT * FROM Device INNER JOINdbo.fn_GroupDeviceLink(@groupID) ON ....this fn_GroupDeviceLink should run the proper stored procedure andreturn the values. What i also want to do is play with that result setof the specific stored procedure before i return it. Is this possible?If not, what is the work arround?ThanksMark
View Replies !
Using Begin Transaction,End Transaction, Return,Rollback, Break,Continue
Hi, is there someone who can demonstrate the usgae of these codes in this simple process. I have a table that has (id int, Balance money) I want to write codes to utilize the Subject coding in this process. 1.Every time I withdraw money from a client, I want to verrify that he/she has enough money if not I want to roll back transaction. 2.Using Begin Tran , end Tran.. 3. Using Return ,Break,continue I really appreciate your help. Althought I read about this from a book, but it really confused me and I want to see real world example using client and withdraw from there accounts...:) regards Ali
View Replies !
How Do I Make Use Of Begin Transaction And Commit Transaction In SSIS.
Hi How do I make use of begin transaction and commit transaction in SSIS. As am not able to commit changes due to certain update commands I want to explicitly write begin and commit statements. but when i make use of begin and commit in OLEDB commnad stage it throws an error as follows: Hresult:0x80004005 descriptionyntax error or access violation. its definately not an syntax error as i executed it in sql server. also when i use it in execute sql task out side the dataflow container it doesnt throw any error but still this task doesnt serve my purpose of saving/ commiting update chanages in the database. Thanks, Prashant
View Replies !
Help Convert MS Access Function To MS SQL User Defined Function
I have this function in access I need to be able to use in ms sql. Having problems trying to get it to work. The function gets rid of the leading zeros if the field being past dosn't have any non number characters.For example:TrimZero("000000001023") > "1023"TrimZero("E1025") > "E1025"TrimZero("000000021021") > "21021"TrimZero("R5545") > "R5545"Here is the function that works in access:Public Function TrimZero(strField As Variant) As String Dim strReturn As String If IsNull(strField) = True Then strReturn = "" Else strReturn = strField Do While Left(strReturn, 1) = "0" strReturn = Mid(strReturn, 2) Loop End If TrimZero = strReturnEnd Function
View Replies !
In-Line Table-Valued Function: How To Get The Result Out From The Function?
Hi all, I executed the following sql script successfuuly: shcInLineTableFN.sql: USE pubs GO CREATE FUNCTION dbo.AuthorsForState(@cState char(2)) RETURNS TABLE AS RETURN (SELECT * FROM Authors WHERE state = @cState) GO And the "dbo.AuthorsForState" is in the Table-valued Functions, Programmabilty, pubs Database. I tried to get the result out of the "dbo.AuthorsForState" by executing the following sql script: shcInlineTableFNresult.sql: USE pubs GO SELECT * FROM shcInLineTableFN GO I got the following error message: Msg 208, Level 16, State 1, Line 1 Invalid object name 'shcInLineTableFN'. Please help and advise me how to fix the syntax "SELECT * FROM shcInLineTableFN" and get the right table shown in the output. Thanks in advance, Scott Chang
View Replies !
Usage Of Begin Transaction.... Commit Transaction??
Hi, anyone can help,I am trying to learn how to use begin tran..commit tran .. rollback tran by doing this exercise... unfortunatelly,it did not work...anyone can help... I have a table named tbl_balance(investor_id int,amount money) I want to insert/update balance for each investor. I wrote a procedure but it didnot work::: declare @investorid int, @amount money,@error_status int select @investorid=1 select @amount = 500 /* to check if investor exist in the tbl_balance table, if so execute the codes */ IF exists(select investorid from tbl_bal where investorid=@investorid ) begin tran begin update tbl_balance set amount=amount+@amount where investorid =@investorid if (@error_status<> 0) begin ROLLBACK tran select 'you did not update' end else begin COMMIT tran select ' YOu did update ' end end IF not exists(select investorid from tbl_bal where investorid=@investorid ) begin tran begin insert into tbl_balance values(@investorid,@amount) if (@error_status<> 0) begin ROLLBACK tran select 'you did not update' end else begin COMMIT tran select ' YOu did update ' end end
View Replies !
Problem With SSIS Transaction...Transaction Scope
Hi, I am having some problem with SSIS transaction. Eventhought I tried to imitate the concept that Jamie presented at http://www.sqlservercentral.com/columnists/jthomson/transactionsinsqlserver2005integrationservices.asp . My workflow is as followed ********************************* For Each ADO.Record in Oracle (transaction=not supported) If (Certain_Field_Value = 'A') Lookup Data in SQL DB with values from Oracle (transaction=not supported) DO Sequence A (Start a Transaction , transaction=required) INSERT/UPDATE some records in SQLDB(transaction=supported) Finish Sequence A ( transaction should stop here) UPDATE Oracle DB ( Execute SQLTask, transaction=not supported) If (Certain_Field_Value = 'B') Lookup Data in SQL DB with values from Oracle (transaction=not supported) DO Sequence B (Start a Transaction , transaction = required) INSERT/UPDATE some records in SQLDB (transaction=supported) Finish Sequence A ( transaction should stop here) UPDATE Oracle DB ( Execute SQLTask, transaction=not supported) If (Certain_Field_Value = 'C') ------------ ------------ End ForEach Loop ************************************* My requirements are that I want separate transaction for each Sequence A, B, C, etc... If Sequence A transaction fails, the other should still be continuing with another transaction. But I am getting an error regarding the OLEDB Error in next Task (e.g in Certain_Field_Value = 'B') "Lookup Data in SQL DB with values from Oracle ", the error message is ".......Distributed transaction completed. Either enlist this session in a new transaction or the NULL transaction. ". What is it that I am doing wrong? Regards KyawAM
View Replies !
|