Click here to monitor SSC
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

udf?,isolation ? Expand / Collapse
Author
Message
Posted Friday, April 12, 2013 6:04 AM
SSC Journeyman

SSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC Journeyman

Group: General Forum Members
Last Login: Saturday, March 5, 2016 12:42 AM
Points: 83, Visits: 480
i have 2 questions??
1.can we use insert,delete inside user defined function(i tried myself it showing error 'side-effecting operator 'DELETE' within a function.')?
if not why?
2.what is isolation in sql server? where it is used ?
Post #1441655
Posted Friday, April 12, 2013 6:17 AM


SSChampion

SSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampion

Group: General Forum Members
Last Login: Yesterday @ 1:31 PM
Points: 14,407, Visits: 37,678
gurjer48 (4/12/2013)
i have 2 questions??
1.can we use insert,delete inside user defined function(i tried myself it showing error 'side-effecting operator 'DELETE' within a function.')?
if not why?


No you can't with the slight exception of manipulating a @Table variable. the reason is in SQL server, FUNCTIONS are a streamlined form of a stored procedure, and can only perform READ operations (ie SELECT.
it cannot insert/update/delete to any table or #temp table either. if you need to do that, you have to use a stored proc


2.what is isolation in sql server? where it is used ?

MS can probably describe it better than me:
http://msdn.microsoft.com/en-us/library/ms173763.aspx?ppud=4

basically, the isolation level decides what rules are in place when two people are using the same data at the same time: so if i'm updating some data, lets say your lunch schedule, for 12:00 to 1:00 , do you see the data as it existed how it was before i finish updating(still 12:00, or does your request have to wait you have to wait till i'm done committing the transaction before you can see the data.


Lowell

--
help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!
Post #1441661
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse