-
Hi Lakmal, If you are using SQL Server 2005: Try using a Try-Catch block within the loop and increment the loop counter in the Catch block. If you are using SQL Server 2000: Try using the following code after each statement in the loop: IF @@ERROR != 0 GOTO ErrHandler Then at the end of the loop write...
-
As I know; You don't have to lock tables manually, you just need to use a SqlTransaction in C# as below, SqlTransaction tran; SqlConnection con = new SqlConnection("<connectionString>"); SqlCommand com = new SqlCommand(con,""); try { tran = con.BeginTransaction(); com.Transaction...
-
SP: http://www.hasmeer.blogspot.com/
-
Using Stored procedures is a more standard way and easy to maintain, but it initially take time but long time worth. Using SQL statements is more easy and can apply more security in application leve, but difficult to maintain and read. It is up to you to mix it up with your requirements.
-
I have few reasons for this answer. Database should be running on a server. Stored procedures are saved on the database and purpose of the stored procedures is executing some sql commands within the database. So Stored procedures doesn't transfer through the network ( According to myknowledge) So...
-
I wants to avoid repeating same codings . for a example BEGIN IF (@InteractionID > 0 and @MainTypeID > 0 and @CallTypeID = 0 AND @ActionTypeID = 0) BEGIN set @RestCoding = 'where H_CustomerCallLog.CallInteractionTypeID = @InteractionID and H_CustomerCallLog.CallMainTypeID = @MainTypeID '...
-
I need to use IF condition inside Where clause for a Stored procedure . Please send me sample codings for that. Thank you.
-
Stored procedures and triggers are both sets of SQL statements that are stored on the SQL Server with a given name. A stored procedure can be called explicitly, which would in turn execute the code defined within it. Whereas, a trigger is created for a particular table and is executed implicitly when...
-
Hi, You can perform the required operation without using loops using set-based operations (which T-SQL is all about). I have tried to understand your problem and have come up with an SP. See if this is what you want: CREATE PROCEDURE UpdateInventory @strItemNumber varchar ( 10 ) AS BEGIN DECLARE @fltActualPrice...
-
Im restoring a database every month-end to another server and its executing this task within a stored proc. for an example, April DB name is ABC200804 (Last 6 digits are vary). after restoration completed, I need to change some sensitive data (Like credit card information) in to dummy numbers. to do...