Thursday, May 31, 2012

Delete cache

When You need to delete data from cache, it can be done with following command:


DBCC DROPCLEANBUFFERS
 
On link more info about this subject can be found.
 
Also, if You want to remove procedure plans from cache, it can be done with following command:

DBCC FREEPROCCACHE

 On following link more info can be found. 

Wednesday, May 23, 2012

How to access attribute in assembly

Yesterday we had a problem accessing property (attribute) in assembly, which is created over some dll.

For more about assemblies, please read this article.

It is not a problem create function over some method in assembly, but If you want to access some parameter, following trick should be used.

Instead of creating function over parameter name, add prefix get_ before parameter name, as shown in following code:

CREATE FUNCTION dbo.SomeFunction ()
RETURNS [nvarchar](128) WITH EXECUTE AS CALLER
AS
EXTERNAL NAME [AssemblyName].[NamespaceName].get_PropertyName
GO


One of my colleagues helped me with this and I am thankful for that.