Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / CLR / November 2007

Tip: Looking for answers? Try searching our database.

I set my database to trustworthy and deployed this clr stored proc as unsafe ok but when i run this it returns 1 each time. as if ival keeps getting set back to 0 each time i call this clr stored proc. How to fix so that ival keeps its current value each t

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
DR - 30 Oct 2007 00:18 GMT
I set my database to trustworthy and deployed this clr stored proc as unsafe
ok but when i run this it returns 1 each time. as if ival keeps getting set
back to 0 each time i call this clr stored proc. How to fix so that ival
keeps its current value each time i execute this from sql server?

public partial class UserDefinedFunctions
{
   static long ival = 0;
   [Microsoft.SqlServer.Server.SqlFunction]
   public static long GetTimestampF()
   {
       return ++ival;
   }
};
Ben Voigt [C++ MVP] - 12 Nov 2007 16:36 GMT
>I set my database to trustworthy and deployed this clr stored proc as
>unsafe ok but when i run this it returns 1 each time. as if ival keeps
>getting set back to 0 each time i call this clr stored proc. How to fix so
>that ival keeps its current value each time i execute this from sql server?

Store it in the database, that's the only way to ensure it keeps its value
through restarts, etc.

> public partial class UserDefinedFunctions
> {
[quoted text clipped - 5 lines]
>    }
> };
DR - 14 Nov 2007 01:42 GMT
that would be a disk access not shared memory

>>I set my database to trustworthy and deployed this clr stored proc as
>>unsafe ok but when i run this it returns 1 each time. as if ival keeps
[quoted text clipped - 14 lines]
>>    }
>> };
Ben Voigt [C++ MVP] - 14 Nov 2007 14:44 GMT
> that would be a disk access not shared memory

The database engine ought to cache it in memory under normal circumstances.

>>>I set my database to trustworthy and deployed this clr stored proc as
>>>unsafe ok but when i run this it returns 1 each time. as if ival keeps
[quoted text clipped - 14 lines]
>>>    }
>>> };

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.