Actually I want that If my system gives one record to one person for
modification or to do some work on it then record must not be given to
any other. for example in this case I have a project for telemarkting.
there are 3-4 person sitting in front of systems and have one shared
DB. Now my project should gave them a Company's contact no so that they
can communicate with that company. I want that if my syatem gives
company record 1 to employee 1 then it should not be given to any other
person. Can you guide me about stored procedure that can do this or is
there any alternative way availabe for it. Ishall be very thankful to
you.
[quoted text, click to view] Uri Dimant wrote:
> I'm not sure that understand your requirement
>
> BEGIN TRAN
>
> SELECT col FROM TableName (UPDLOCK,HOLDLOCK)
>
>
> COMMIT TRAN
>
> Note, readers don't get blocked
>
> "Muhammad Ahsin Saleem" <ahsin.saleem@gmail.com> wrote in message
> news:1159158795.894329.64950@m7g2000cwm.googlegroups.com...
> > hi
> > everyone I have a problem that I have an application having a shared DB
> > and I want that when I retrieve a record from database for one machine
> > then that record must be locked so that others couldnot modify that
> > record. I need urgant help I shall be thankful to all of you if anybody
> > can help me.
> >
Hi
[quoted text, click to view] > can communicate with that company. I want that if my syatem gives
> company record 1 to employee 1 then it should not be given to any other
> person. Can you guide me about stored procedure that can do this or is
> there any alternative way availabe for it. Ishall be very thankful to
> you.
And others are just waiting or what?
Again
BEGIN TRAN
COMMIT TRAN
will lock the session untill it the transaction will be commited or
rollback
Another way I can think is to maintain an additon column to indicate whether
the company ID has aleady given and doing an appropriate job for others
[quoted text, click to view] "Muhammad Ahsin Saleem" <ahsin.saleem@gmail.com> wrote in message
news:1159162220.441699.239370@d34g2000cwd.googlegroups.com...
> Actually I want that If my system gives one record to one person for
> modification or to do some work on it then record must not be given to
> any other. for example in this case I have a project for telemarkting.
> there are 3-4 person sitting in front of systems and have one shared
> DB. Now my project should gave them a Company's contact no so that they
> can communicate with that company. I want that if my syatem gives
> company record 1 to employee 1 then it should not be given to any other
> person. Can you guide me about stored procedure that can do this or is
> there any alternative way availabe for it. Ishall be very thankful to
> you.
>
> Uri Dimant wrote:
>> I'm not sure that understand your requirement
>>
>> BEGIN TRAN
>>
>> SELECT col FROM TableName (UPDLOCK,HOLDLOCK)
>>
>>
>> COMMIT TRAN
>>
>> Note, readers don't get blocked
>>
>> "Muhammad Ahsin Saleem" <ahsin.saleem@gmail.com> wrote in message
>> news:1159158795.894329.64950@m7g2000cwm.googlegroups.com...
>> > hi
>> > everyone I have a problem that I have an application having a shared DB
>> > and I want that when I retrieve a record from database for one machine
>> > then that record must be locked so that others couldnot modify that
>> > record. I need urgant help I shall be thankful to all of you if anybody
>> > can help me.
>> >
>
Hi
CREATE PROCEDURE usp_GetCompanyCode
@CompanyCode INT
AS
BEGIN TRAN
SELECT <columns> FROM TableName WITH (UPDLOCK,HOLDLOCK)
--Do here another operation
COMMIT TRAN
GO
---Usage
EXEC usp_GetCompanyCode @CompanyCode =1000
[quoted text, click to view] "Muhammad Ahsin Saleem" <ahsin.saleem@gmail.com> wrote in message
news:1159170935.933457.159040@m7g2000cwm.googlegroups.com...
> Others are also getting data from the DB at the same time. Also kindly
> if you can give me stored procedure code do give me I need it very
> badly.
> Uri Dimant wrote:
>> Hi
>>
>> > can communicate with that company. I want that if my syatem gives
>> > company record 1 to employee 1 then it should not be given to any other
>> > person. Can you guide me about stored procedure that can do this or is
>> > there any alternative way availabe for it. Ishall be very thankful to
>> > you.
>>
>> And others are just waiting or what?
>>
>> Again
>> BEGIN TRAN
>> COMMIT TRAN
>> will lock the session untill it the transaction will be commited or
>> rollback
>>
>> Another way I can think is to maintain an additon column to indicate
>> whether
>> the company ID has aleady given and doing an appropriate job for others
>>
>>
>>
>>
>> "Muhammad Ahsin Saleem" <ahsin.saleem@gmail.com> wrote in message
>> news:1159162220.441699.239370@d34g2000cwd.googlegroups.com...
>> > Actually I want that If my system gives one record to one person for
>> > modification or to do some work on it then record must not be given to
>> > any other. for example in this case I have a project for telemarkting.
>> > there are 3-4 person sitting in front of systems and have one shared
>> > DB. Now my project should gave them a Company's contact no so that they
>> > can communicate with that company. I want that if my syatem gives
>> > company record 1 to employee 1 then it should not be given to any other
>> > person. Can you guide me about stored procedure that can do this or is
>> > there any alternative way availabe for it. Ishall be very thankful to
>> > you.
>> >
>> > Uri Dimant wrote:
>> >> I'm not sure that understand your requirement
>> >>
>> >> BEGIN TRAN
>> >>
>> >> SELECT col FROM TableName (UPDLOCK,HOLDLOCK)
>> >>
>> >>
>> >> COMMIT TRAN
>> >>
>> >> Note, readers don't get blocked
>> >>
>> >> "Muhammad Ahsin Saleem" <ahsin.saleem@gmail.com> wrote in message
>> >> news:1159158795.894329.64950@m7g2000cwm.googlegroups.com...
>> >> > hi
>> >> > everyone I have a problem that I have an application having a shared
>> >> > DB
>> >> > and I want that when I retrieve a record from database for one
>> >> > machine
>> >> > then that record must be locked so that others couldnot modify that
>> >> > record. I need urgant help I shall be thankful to all of you if
>> >> > anybody
>> >> > can help me.
>> >> >
>> >
>