Transactions - With User Interaction
Aug 30, 2001
Hi folks
I have a complex tree control, which should allow a 'power' user to modify/add/delete information to a database. To simplify coding, I want to make any changes immediately, but within a transaction.
For example:
Begin transaction
Do some changes
Commit transaction
The idea is, at the end of the edit session, the 'power' user then clicks Save or Cancel. I can then commit or rollback as necessary. Sounds easy!
Whilst this is going on, I want other users to be able to read the same tables that are potentially being updated.
I find that the updates are written immediately to the database - rather than being stored in a temporary area. Hence, other users see these changes directly.
I also find that other users cannot always read the tables, as they are locked out pending the updates from the 'power' user. (This works for the first 4 or 5 reads, and then fails intermittently.)
I know this functionality works in Oracle, but the SQL Server documentation suggests this is simply not a supported function.
Any ideas/comments would be appreciated.
Thanks - Jen
View 1 Replies
ADVERTISEMENT
Jun 5, 2003
Does anyone know how you can write a script in DTS to ask the user for data through a prompt e.g. a date range?
View 7 Replies
View Related
Jul 23, 2005
I am a Windows admin who knows how to administer SQL server, but I don'thave any experience in creating a data interface so that regular users, whodon't know anything about SQL commands, can manipulate the data.Any good books or suggestions? Basically I want to be able to createsomething possibly by users using a web browser. I have some Perl scriptingexperience if that helps.Thanks,CJ
View 2 Replies
View Related
Sep 14, 2007
I've been playing around with building custom components for SSIS. I've been doing workflow for years (using Java and Oracle). The company I worked for had a framework for publishing data that allowed for user interaction. That's something I'd love to be able to do in SSIS.
Is it possible to create a custom task that interacts with the user at runtime? So, the user starts the SSIS package. At some point, the process pops up a dialog (Windows Form) that asks the user to set a date using a calendar control.
Any thoughts?
View 4 Replies
View Related
Oct 17, 2006
Hi there,
I've just started learning SQL - I already know a bit of VB/VBA and my aim is to become a software developer using both SQL and VB.
One question I have is how would the average programmer go about managing the database? Are SQL commands (queries/add record/make table etc) normally programmed and controlled in VB itself via the docommand.runSQL on the event triggers or are they managed from the SQL Server application themselves? Also, if there are any other comments on how VB works with SQL I'd be very interested to hear them.
My assumption is that the database commands are managed from VB and any automated download/import or export of data into or from the SQL database is scheduled from SQL server itself.
Many thanks for your time in reading.
View 7 Replies
View Related
Nov 16, 2007
Is there a way to cause the selection of one parameter to change the value of another parameter? I know I can set defaults but I want to be able to have the selection of one parameter force a change on another.
I have two parameters, one for fiscal year and one for calendar year. When I select a calendar year I want the fiscal year to be set to 'all' and vice versa.
Thanks.
View 3 Replies
View Related
May 25, 2007
hi all,
this is my question:
can a stored procedure interact with a FTP-server that has nothing to do with the database the stored procedure is running from??
I want my stored procedure to delete records in my database AND my FTP-server in the same time..., so also uploaded files which have been uploaded to a FTP-server during the same session when data has been written to my database...???
this is my SP for deleting records in my database:
...
DELETE FROM dbo.tblUploadsIntern WHERE DATEDIFF(dd,GETDATE(), tblUploadsIntern.uplZipfileDateTimeOffline) > 7
END
GO
the code for deleting files on FTP-server works also...
thanks in advance...
View 1 Replies
View Related
Oct 11, 2007
Hi everyone,
I have a question related to data flow task's block. Lets say i have a problem to solve that consist of 5 major transformation steps and each transformation step ends with a Result set, this result set of Step1 is required by Step2 and the Result set of step2 is required by 3 ....
now i can solve the the problem inside a single "data flow task" block but this is not my aim, since this is not clean aproach specially if the calculation and transformation requires a lof of task so since i would like to solve the problem in differnt block depending on the complexity and logic of the problem.
My Question is how can I pass Result set of a "data flow task" block from step a to the "data flow task" Block of Step B in the Controll flow view(tab) , i tried connecting both blocks as in the dataflow view(tab) by my connections does not show any metadata informations which mean the do not contains any afaik.
thanks in Advance
e. Yassine
View 11 Replies
View Related
Nov 21, 2006
Hi all,
I would be very glad if someone can suggest me what techniques I should use in the following scenario:
I have 2 SQL Server databases : DB1 and DB2. DB 1 is on a remote server (hosting server) and DB 2 is on a local server.
Some tables of each db contain tables that are polulated and changed by the appropriate application, i.e.:
DB1.users, DB1.orders,... etc are managed by "webapplication"
DB1.products ... are not managed by "webapplication" : in fact only used to read from
DB2.products, DB2.customers, .... etc are managed by "winapplication"
DB2.orders,....are partially managed by "winapplication"
Since the amount of data can go over 100000 records i'm wondering what would by the best approach to :
- synchronize the data of DB1.products and DB2.products in DB1 on remote server (updated newly added rows and update changed rows,....)
- the products data is only (at the moment) added, edited and deleted on the local server
I think SQLBulkCopy will not do the job. Should it be possible with some query? Or...?
Any suggestions are appreciated!!
O.
View 1 Replies
View Related
Jul 20, 2005
Hi,I am new to SQL. Please bear with me and allow me to ask a dumbquestion.I am debugging a stored procedure (written in Trans-SQL), and I foundthat the SQL analyzer that I use doesn't have a debugger. All I cando it is execute a block of code and see what is going on in aninteraction seesion of the SQL analyzer. I would need to declare somevariable to hold values of the previous query in the interactivesession.I understand that this can be easily done in a stored procedure viathe Declare command (e.g., Delcare @order_no int). Is similarfunctionality exists in an interaction session of the SQL analyzer?If so, what is the command. Please advise.Thank you very much for the help.Alex
View 1 Replies
View Related
May 22, 2005
Hi there,
I have decided to move all my transaction handling from asp.net to stored procedures in a SQL Server 2000 database. I know the database is capable of rolling back the transactions just like myTransaction.Rollback() in asp.net. But what about exceptions? In asp.net, I am used to doing the following:
<code>Try 'execute commands myTransaction.Commit()Catch ex As Exception Response.Write(ex.Message) myTransaction.Rollback()End Try</code>Will the database inform me of any exceptions (and their messages)? Do I need to put anything explicit in my stored procedure other than rollback transaction?
Any help is greatly appreciated
View 3 Replies
View Related
Dec 18, 2007
Hi
I am running into issues with custom objects interaction with visual studio 2005.
1. Custom connection manager.
I am setting the name of the connection manager ( to standardize naming convention ) that user created, however when the CM is created, the name displayed in visual studio is still the default name even if the real name is the one i set. I have to do things like, edit it or save package - close - reopen, create another connection, ... etc in order to get it refreshed.
2. Custom Task
I am managing some variables in this custom task so that I will be adding and deleting variables in the package.
The challenge i am running into is, when I added 2 variables for example, even though the variables are successfully added to package, the Variable Window in visual studio designer will not reflect the new variables. I have to save package, close, and re-open in order for the variables to show up.
So this brings to my question - is there any way to tell Visual Studio programmatically to refresh the contents of these 2 sections, 1 is the Variable Window and the other is the panel containing the list of connection managers.
I have been searching around and found some clue about visual studio SDK but I still cannot find an exact way of doing it. Visual Studio SDK example tells you how you can access the Variable window as
framesList = new List<IVsWindowFrame>();
toolWindowNames = new List<string>();
// Get the UI Shell service
IVsUIShell uiShell = (IVsUIShell)Microsoft.VisualStudio.Shell.Package.GetGlobalService(typeof(SVsUIShell));
// Get the tool windows enumerator
IEnumWindowFrames windowEnumerator;
ErrorHandler.ThrowOnFailure(uiShell.GetToolWindowEnum(out windowEnumerator));
IVsWindowFrame[] frame = new IVsWindowFrame[1];
uint fetched = 0;
int hr = VsConstants.S_OK;
// Note that we get S_FALSE when there is no more item, so only loop while we are getting S_OK
while (hr == VsConstants.S_OK)
{
// For each tool window, add it to the list
hr = windowEnumerator.Next(1, frame, out fetched);
ErrorHandler.ThrowOnFailure(hr);
if (fetched == 1)
{
// We successfully retrieved a window frame, update our lists
string caption = (string)GetProperty(frame[0], (int)__VSFPROPID.VSFPROPID_Caption);
toolWindowNames.Add(caption);
framesList.Add(frame[0]);
}
}
But i looked up the methods for IVsWindowFrame and it does not have anything to refresh the contents of the frame.
I thought about firing events but cannot find which one to fire.
Any help on this will be greatly appreciated.
Terry
View 14 Replies
View Related
Jan 14, 2008
This problem is being seen on SQL 2005 SP2 + cumulative update 4
I am currently successfully using the output clause of an insert statement to return the identity values for inserted rows into a table variable
I now need to add an "instead of insert" trigger to the table that is the subject of the insert.
As soon as I add the "instead of insert" trigger, the output clause on the insert statement does not return any data - although the insert completes successfully. As a result I am not able to obtain the identities of the inserted rows
Note that @@identity would return the correct value in the test repro below - but this is not a viable option as the table in question will be merge replicated and @@identity will return the identity value of a replication metadata table rather than the identity of the row inserted into my_table
Note also that in the test repro, the "instead of insert" trigger actually does nothing apart from the default insert, but the real world trigger has additional code.
To run the repro below - select each of the sections below in turn and execute them
1) Create the table
2) Create the trigger
3) Do the insert - note that table variable contains a row with column value zero - it should contain the @@identity value
4) Drop the trigger
5) Re-run the insert from 3) - note that table variable is now correctly populated with the @@identity value in the row
I need the behaviour to be correct when the trigger is present
Any thoughts would be much appreciated
aero1
/************************************************
1) - Create the table
************************************************/
CREATE TABLE [dbo].[my_table](
[my_table_id] [bigint] IDENTITY(1,1) NOT NULL,
[forename] [varchar](100) NULL,
[surname] [varchar](50) NULL,
CONSTRAINT [pk_my_table] PRIMARY KEY NONCLUSTERED
(
[my_table_id] ASC
)WITH (PAD_INDEX = OFF, IGNORE_DUP_KEY = OFF, FILLFACTOR = 70) ON [PRIMARY]
)
GO
/************************************************
2) - Create the trigger
************************************************/
CREATE TRIGGER [dbo].[trig_my_table__instead_insert] ON [dbo].[my_table]
INSTEAD OF INSERT
AS
BEGIN
INSERT INTO my_table
(
forename,
surname)
SELECT
forename,
surname
FROM inserted
END
/************************************************
3) - Do the insert
************************************************/
DECLARE @my_insert TABLE( my_table_id bigint )
declare @forename VARCHAR(100)
declare @surname VARCHAR(50)
set @forename = N'john'
set @surname = N'smith'
INSERT INTO my_table (
forename
, surname
)
OUTPUT inserted.my_table_id INTO @my_insert
VALUES( @forename
, @surname
)
select @@identity -- expect this value in @my_insert table
select * from @my_insert -- OK value without trigger - zero with trigger
/************************************************
4) - Drop the trigger
************************************************/
drop trigger [dbo].[trig_my_table__instead_insert]
go
/************************************************
5) - Re-run insert from 3)
************************************************/
-- @my_insert now contains row expected with identity of inserted row
-- i.e. OK
View 5 Replies
View Related
Dec 7, 2006
This is my first time to deploy an asp.net2 web site. Everything is working fine on my local computer but when i published the web site on a remote computer i get the error "Failed to generate a user instance of SQL Server due to failure in retrieving the user's local application data path. Please make sure the user has a local user profile on the computer. The connection will be closed" (only in pages that try to access the database)
Help pleaseee
View 3 Replies
View Related
May 22, 2008
Hi,
Please give the T-SQL script for this ? Thanks
Shanth
View 4 Replies
View Related
Sep 28, 2007
When I am in Visual Studio 2005, and I try to add an SQL database, I get the following error "generating user instances in sql server is disabled. use sp_configure user instances enabled to generate user instances." I am currently using SQL server 2005 Express. What do I need to do, to create an SQL database? Thanks in advance.
View 4 Replies
View Related
Aug 13, 2003
Hi All,
Can anybody suggest me a website where I can find articles on Managing transactions with Sql server. Also a scenario where the transactions take place in a environment involving 2 different databases, Like the bank account and credit card transactions (specifically of 2 way kind)
Thanks
View 5 Replies
View Related
Apr 6, 2005
I have a web application with a shopping cart, how do I stop all the shopping cart transaction from going into the db log? Is this possible? These are are only transient data movements, and will never be need to to restore to, and they are cause log bloat. Or is there a better way to stop log bloat?
Thanks
View 2 Replies
View Related
Apr 17, 2000
Hi All,
How can we change connection properties in a DTS pkg with connection?
You can loop through the connection count but the connection ID is not static one.So can’t rely on that.
Is there another way of changing connection properties?
Thanks in Advance
Barath
View 4 Replies
View Related
Sep 5, 2000
Hi all....
I am currently designing a DTS Package to import data that is processed daily into a large database.
I have to design the package such that if any step fails when importing, I roll back the entire transaction.
I have designed the package with this in mind, checked "join transaction if present" and "rollback transaction on failure" in all of the workflows. I have also made all workflows serialized.
However, when I run the package, it fails on one of the data pumps with the error:
Transaction context in use by another session.
Any ideas?
Thank you,
Brian
View 2 Replies
View Related
Dec 1, 2000
I am replicating (finally!!) and on my publishers agent history I can see it says xx transactions with xx commands were delivered. (xx being the number)
Where can I look to see what the transactions or commands are?
Is there a place the system stores this information?
View 1 Replies
View Related
Oct 17, 2003
what is maximum limit of no. of transactions per sec. in sql server 2000
View 2 Replies
View Related
Sep 6, 2004
Is there a point to wrapping a single UPDATE or INSERT statement in an explicit TRANSACTION:
BEGIN TRANSACTION
INSERT INTO Table (...) VALUES (...)
COMMIT TRANSACTION
I understand ACID and concept of transactions. However, I thought they were only necessary for multi-statement operations. I'm maintaining code that does this and am wondering if this is necessary. Does SQL Server guarantee ACID for single statements? Are single UPDATE/INSERT statements prone to race condition like affects without using explicit transactions?
View 2 Replies
View Related
Apr 17, 2008
Are there any scenarios where an un-commited transaction would block further queries?
View 1 Replies
View Related
May 27, 2008
If you run the Begin Transaction code and then run a create such as an update query and you see that it effects the number of rows that you wanted it to effect is there a way to look at the actual data that changed before you Commit Transaction?
Thanks!
View 7 Replies
View Related
Jul 1, 2007
I have a table with around 240 columns and one of the column in the Table is the Inserttime ( DATETIME ) and I using a GETDATE() function in the stored Proc, when we insert data into the table. In the same Milli second 2007-06-27 09:32:58.303 , I have around 7600 records in the database. The Stored Proc is called for each Individual record and we don't bunch the transactions. Is this possible.
I did some bench marking on this server and I can insert only 700 - 800 records approx / sec on this particular table.
Thanks
View 6 Replies
View Related
Aug 1, 2007
I have a small database that I have been testing.I get an error about a transaction deadlock.The code is in stored procedures and I added transactions to the sp'sbut the error happened again.I wrapped the whole sp in just one transaction and I don't have anyindex on the tables.When I test just by running a program that sends 3 calls at a time itwill get a deadlocked transaction as I send 6 or 9 at a time.I am not sure how it can have a deadlocked transaction after I usedtransactions(begin and commit) in the sp's.Steve
View 4 Replies
View Related
Oct 8, 2007
I am working with transactions and use try catch to capture errors and in the event of an error i have to rollback the transaction. How can i perform this?, most of the errors which i forsee are either insertion of null values into non nullable columns or violation of Primary keys while inserting duplicates.
I started by coding the following way but it does not rollaback apparently the try catch does not work for above kind of errors..Can somebody help..
DECLARE @REPORTING_PERIOD VARCHAR(6)
BEGIN TRY
BEGIN TRANSACTION
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SET NOCOUNT ON;
SET @REPORTING_PERIOD =(Select REPORT_PERIOD_ID from dbo.T_REPORT_PERIOD where C_FLAG_ACTIVITY=1)
--Step 1
INSERT INTO [dbo].[T_COUNTRIES]
([C_COUNTRY]
,[LB_COUNTRY]
,[C_REGION]
,[FK_REPORTING_PERIOD])
SELECT [C_COUNTRY]
,[LB_COUNTRY]
,[C_REGION]
,@REPORTING_PERIOD
FROM [dbo].[IN_T_COUNTRIES]
--Step 2
INSERT INTO [dbo].[T_FLE]
([FK_P_FLE]
,[C_COSMOS]
,[LB_FLE]
,[C_PARETO]
,[C_OPCO_SCOPE]
,[C_LEVEL]
,[C_FLE_TYPE]
,[C_ACTIVITY]
,[F_MATERIAL]
,[C_MATERIAL_PRIORITY]
,[C_CALCULATION_METHOD]
,[F_CREDIT_RISK_MATERIALITY]
,[V_PARTICIPATION]
,[FK_REPORTING_PERIOD])
SELECT Null as [FK_P_FLE]
,[C_COSMOS]
,[LB_FLE]
,[C_PARETO]
,[C_OPCO_SCOPE]
,[C_LEVEL]
,[C_FLE_TYPE]
,@REPORTING_PERIOD
FROM [dbo].[IN_T_FLE]
COMMIT TRANSACTION
END TRY
BEGIN CATCH
SELECT
ERROR_NUMBER() as ErrorNumber,
ERROR_LINE() as ErrorLine,
ERROR_MESSAGE() as ErrorMessage;
-- Test XACT_STATE for 1 or -1.
-- XACT_STATE = 0 means there is no transaction and
-- a commit or rollback operation would generate an error.
-- Test whether the transaction is uncommittable.
IF (XACT_STATE()) = -1
BEGIN
PRINT
N'The transaction is in an uncommittable state. ' +
'Rolling back transaction.'
ROLLBACK TRANSACTION;
END;
-- Test whether the transaction is active and valid.
IF (XACT_STATE()) = 1
BEGIN
PRINT
N'The transaction is committable. ' +
'Committing transaction.'
COMMIT TRANSACTION;
END;
END CATCH;
View 3 Replies
View Related
Nov 8, 2006
Hello All,
When i am working with Transactions i got one doubt.
If i am inserting any records into a table with primary key if a transaction is rolled back i am finding one primary ID is missing. Is it so.
View 3 Replies
View Related
Apr 2, 2007
I've been searching around and haven't found anything that simply states what I want to know.
I want to use a transaction within my CLR Stored Proc, to do so I've got System.Transactions referenced and I can access the current transaction via Transaction.Current.
My questions are
Will there always be a current transaction?
Do I need to create a new transaction if one doesn't already exist?
View 3 Replies
View Related
Sep 4, 2006
Hi world:
I have this issue:
I need to push rows from CE to SQL Server 2000 and after delete these rows of CE database only if all rows have been sent to SQL Server 2000.
I think the best is work with transactions. Since I know I can use transactions for this purpose, can anybody give me a link with push transaction examples ?
View 4 Replies
View Related
Dec 17, 2007
Hi all,
What does "Transactions/sec" counter in SQL 2005 under databases do in terms of performance. My counter shows almost 100% all the time in 4 terrbyte DB in superdome with many CPUs.
Which is the optimal value for this counter?
thanks in advance
Priw
View 1 Replies
View Related
Mar 31, 2008
Hi,
I am using C#.NET 2005, SQL Server 2000.
I have a few questions to ask. Firstly, can anybody help me by telling the difference between the code below and the same code with comments removed:
string localquery = "select bla bla"; SqlDataAdapter _sda; DataTable _dt; SqlCommand _cmd; bool isErrCatched = false; Exception ExcToThrow = new Exception(); using (SqlConnection _cn = NewConnection) // NewConnection returns a static SQLConnection object { _cn.Open(); _cmd = new SqlCommand(localquery, _cn); //SqlTransaction myTrans; //myTrans = _cn.BeginTransaction(); //_cmd.Transaction = myTrans; _dt = new DataTable(); _sda = new SqlDataAdapter(_cmd); try { _sda.Fill(_dt); _sda.Dispose(); //myTrans.Commit(); } catch (Exception exc) { //try { myTrans.Rollback(); } catch {} isErrCatched = true; ExcToThrow = exc; } finally { _cn.Close(); } _cmd.Dispose(); } _cmd = null; if (isErrCatched) throw ExcToThrow; return _dt;
My first question: Can there be a performance loss if I uncomment the lines about transaction usage? I mean, when I do this I start to get more timeouts.
My problem goes on. When I comment those lines and run a stress tool, I am getting "column X does not belong to table Y" errors. If those lines are not commented i am not getting this error, but I get timeout errors frequently. So, my second question: is there something wrong in my query or is there a bad coding practice I am following? Could someone offer a better and more robust sample for this code block?
By the way, connection pooling is on. And these errors are observed under high loads.
Thanks everybody.
View 3 Replies
View Related