July 29, 2010 at 12:13 pm
In worst case 4 for diffrent tables.
Usually 1.
July 29, 2010 at 12:21 pm
If the data is inside a transaction on the insert, it might not appear until the transaction commits.
July 29, 2010 at 12:26 pm
I know,
If we look on my sp it's look like this: (example to insert user I run this sp)
USE [SynopSYS]
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER PROCEDURE [Synopsys].[usp_InsertUser]
(
@UserName NVARCHAR(50)
)
AS
DECLARE @TransactionName NVARCHAR (50)
DECLARE @TransactionMark NVARCHAR (50)
DECLARE @UserId INT
SET @TransactionName = N'InserInto'
SET @TransactionMark = N'Insert New User'
SET @UserId = 0
BEGIN TRANSACTION @TransactionName WITH MARK @TransactionMark;
SET NOCOUNT ON;
/*begin stored procudore body*/
IF NOT EXISTS (SELECT UserName FROM Synopsys.Users WHERE(UserName = @UserName))
BEGIN
INSERT INTO Synopsys.Users(UserName) VALUES(@UserName)
SET @UserId = @@IDENTITY
END
ELSE
SET @UserId = (SELECT Id FROM Synopsys.Users WHERE(UserName = @UserName))
/*End stored procudore body*/
IF @@ERROR = 0
COMMIT TRANSACTION @TransactionName;
ELSE
ROLLBACK TRANSACTION @TransactionName;
SELECT @UserId
July 30, 2010 at 12:21 am
It cannot be possible that query will miss some of records. I suppose there is some problem with the query in the view. May be the where condition for filtering the records may not be correct. Please check
August 1, 2010 at 1:15 am
I'll take the advice given to me previous post. And check whether the query behaves differently with the BETWEEN operator and <> oprator.
I will post my answer.
Thanks for everybody.
Viewing 5 posts - 31 through 35 (of 35 total)
You must be logged in to reply to this topic. Login to reply
This website stores cookies on your computer.
These cookies are used to improve your website experience and provide more personalized services to you, both on this website and through other media.
To find out more about the cookies we use, see our Privacy Policy