Previous Thread:   SqlDependency

2/15/2006 11:33:07 AM    Re: Possible to store public shared variables in SQL Server 2005 ?
Hi Kent,  
  
Although you're probably right with regard to the memory issue, using shared  
  
members does not require UNSAFE access, and I'm not sure that it matters if  
  
it "conflicts with the ACID concept".  Yes, the data stored in-memory in the  
  
CLR probably won't participate in transactions (although that might be  
  
doable), but it might also not be an issue.  Even native to SQL Server we  
  
have constructs that don't participate in transactions: No variables,  
  
including a table variables, participate in transactions (i.e., if you roll  
  
back the tran, the variable will not be reset to its previous state.)  
  
I do think that there are some use cases for introducing static collections,  
  
but they are few and far between.  I don't think we've been given enough  
  
information here to find out if it is a good option in this case.  
  
.... But I'm curious as to how you feel that an XML instance would help in a  
  
cache scenario?  
  
--  
  
Adam Machanic  
  
Pro SQL Server 2005, available now  
  
http://www.apress.com/book/bookDisplay.html?bID=457  
  
--  
  
"Kent Tegels" <ktegels@develop.com> wrote in message  
  
news:b87ad7432cd78c80021b3303500@news.microsoft.com...



2/15/2006 12:34:21 PM    Possible to store public shared variables in SQL Server 2005 ?
I have large ammounts of data(>50.000 records) which I wan't to store an  
  
array. Is it possible to store such an array in memory inside SQL-server,  
  
and to use this array from different stored procedures(CLR) ? (Public,  
  
Shared)  
  
Best regards  
  
Kay-Christian Wessel

2/15/2006 2:33:58 PM    Re: Possible to store public shared variables in SQL Server 2005 ?
Hello Kay-Christian Wessel,  
  
Yes, its called a Temporary Table. :)  
  
Seriously, though, you don't want to introduce objects with shared states  
  
at the SQLCLR, since a.) you're take up memory away from the plan and data  
  
caches and b.) you'd likely have run the code in UNSAFE since you'll likely  
  
introduce mutable, shared statics (which conflicts the ACID concept).  
  
If the records in and of themselves are simple, an XML instance may or may  
  
not be a choice.  
  
Thank you,  
  
Kent Tegels  
  
DevelopMentor  
  
http://staff.develop.com/ktegels/