.NET Framework inside SQL Server ForumNeed help with writing CLR code targeting SQL Server 2005? This forum is a great place to have your questions answered and hear about others’ experiences.© 2009 Microsoft Corporation. All rights reserved.Mon, 30 Nov 2009 12:14:06 Zb5a4d3f3-22a4-481f-a422-6fc395cc3302http://social.msdn.microsoft.com/Forums/en-US/sqlnetfx/thread/f76c85d0-7bba-4abf-826d-c5c40d214de1http://social.msdn.microsoft.com/Forums/en-US/sqlnetfx/thread/f76c85d0-7bba-4abf-826d-c5c40d214de1Bruno_1http://social.msdn.microsoft.com/Profile/en-US/?user=Bruno_1SQLCLR and TransactionsI am pretty new to SQLCLR, in fact i didn't started yet :) i want to make a stored procedure that works as interact with the db: modify data in the database. Is this modification part of the transaction where the stored pricedure is executing ? what i mean if say some error happens when executing the stored procedure, can i roll back the db update from outside the clr code ? I know that i might look very noobish and i am, it is just that i am trying to check if i should go the SQLCLR way or not.<br/> <br/> Thanks<hr class="sig">What should i put here?!Fri, 27 Nov 2009 03:32:48 Z2009-11-30T12:14:06Zhttp://social.msdn.microsoft.com/Forums/en-US/sqlnetfx/thread/1d2cb76b-642f-4067-9667-aacdbc142f74http://social.msdn.microsoft.com/Forums/en-US/sqlnetfx/thread/1d2cb76b-642f-4067-9667-aacdbc142f74kalifumestokalifahttp://social.msdn.microsoft.com/Profile/en-US/?user=kalifumestokalifaMicrosoft.SqlServer.SqlClrProvider...dll ver 10.xx<font size=2><span style="font-family:Arial">I am developing on a machine (XP Prof SP2  32bit) with sql server 2008, VS 2008 and .NEt v3.0 SP1<br><br>I have no problems on my machine but when testing on other machines I get error:<br><br>And I did include Microsoft.SqlServer.Smo.dll, Microsoft.SqlServer.Management.Sdk.Sfc.dll,  Microsoft.SqlServer.ConnectionInfo.dll and Microsoft.SqlServer.Management.Collector.dll so, I am really confused and I can't seem to find </span></font><font size=2><span style="font-family:Arial">file or assembly 'Microsoft.SqlServer.SqlClrProvider, Version=10.0.0.0. <br>                      Any help would be much apreciated.<br></span></font><font size=2><span style="font-family:Arial"><br><br><br><br>************** Exception Text **************<br>Microsoft.SqlServer.Management.Smo.FailedOperationException ---&gt; Microsoft.SqlServer.Management.Sdk.Sfc.EnumeratorException: Failed to retrieve data for this request. ---&gt; System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.SqlServer.SqlClrProvider, Version=10.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91' or one of its dependencies. The system cannot find the file specified.<br>File name: 'Microsoft.SqlServer.SqlClrProvider, Version=10.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91'<br>   at Microsoft.SqlServer.Management.Sdk.Sfc.ObjectLoadInfoManager.LoadHierarchy()<br>   at Microsoft.SqlServer.Management.Sdk.Sfc.ObjectLoadInfoManager.GetFirstObjectLoadInfo(Urn urn)<br>   at Microsoft.SqlServer.Management.Sdk.Sfc.Environment.GetServerVersion(Urn urn, Object ci)<br>   at Microsoft.SqlServer.Management.Sdk.Sfc.Environment.GetObjectInfo(Object ci, RequestObjectInfo req)<br>   at Microsoft.SqlServer.Management.Sdk.Sfc.Enumerator.GetObjectInfo(Object connectionInfo, RequestObjectInfo requestObjectInfo)<br>   at Microsoft.SqlServer.Management.Sdk.Sfc.Enumerator.FixPropertyList(Object connectionInfo, Urn urn, String[] fields, RequestFieldsTypes requestFieldsType)<br>   at Microsoft.SqlServer.Management.Sdk.Sfc.Enumerator.GetData(Object connectionInfo, Request request)<br>   at Microsoft.SqlServer.Management.Sdk.Sfc.Enumerator.Process(Object connectionInfo, Request request)<br><br>WRN: Assembly binding logging is turned OFF.<br>To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1.<br>Note: There is some performance penalty associated with assembly bind failure logging.<br>To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog].<br><br>   --- End of inner exception stack trace ---<br>   at Microsoft.SqlServer.Management.Sdk.Sfc.Enumerator.Process(Object connectionInfo, Request request)<br>   at Microsoft.SqlServer.Management.Sdk.Sfc.Enumerator.GetData(Object connectionInfo, Urn urn)<br>   at Microsoft.SqlServer.Management.Smo.SmoApplication.EnumAvailableSqlServers(Boolean localOnly)<br>   --- End of inner exception stack trace ---<br>   at Microsoft.SqlServer.Management.Smo.SmoApplication.EnumAvailableSqlServers(Boolean localOnly)<br>   at ABSystemInfo.Form1.button1_Click(Object sender, EventArgs e)<br>   at System.Windows.Forms.Control.OnClick(EventArgs e)<br>   at System.Windows.Forms.Button.OnClick(EventArgs e)<br>   at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)<br>   at System.Windows.Forms.Control.WmMouseUp(Message&amp; m, MouseButtons button, Int32 clicks)<br>   at System.Windows.Forms.Control.WndProc(Message&amp; m)<br>   at System.Windows.Forms.ButtonBase.WndProc(Message&amp; m)<br>   at System.Windows.Forms.Button.WndProc(Message&amp; m)<br>   at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message&amp; m)<br>   at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message&amp; m)<br>   at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)<br><br><br>************** Loaded Assemblies **************<br>mscorlib<br>    Assembly Version: 2.0.0.0<br>    Win32 Version: 2.0.50727.42 (RTM.050727-4200)<br>    CodeBase: file:///C:/WINDOWS/Microsoft.NET/Framework/v2.0.50727/mscorlib.dll<br>----------------------------------------<br>AB_System_info<br>    Assembly Version: 1.0.0.0<br>    Win32 Version: 1.0.0.0<br>    CodeBase: file:///C:/Ab%20system%20info/AB_System_info.exe<br>----------------------------------------<br>System.Windows.Forms<br>    Assembly Version: 2.0.0.0<br>    Win32 Version: 2.0.50727.42 (RTM.050727-4200)<br>    CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Windows.Forms/2.0.0.0__b77a5c561934e089/System.Windows.Forms.dll<br>----------------------------------------<br>System<br>    Assembly Version: 2.0.0.0<br>    Win32 Version: 2.0.50727.42 (RTM.050727-4200)<br>    CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System/2.0.0.0__b77a5c561934e089/System.dll<br>----------------------------------------<br>System.Drawing<br>    Assembly Version: 2.0.0.0<br>    Win32 Version: 2.0.50727.42 (RTM.050727-4200)<br>    CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Drawing/2.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll<br>----------------------------------------<br>System.Management<br>    Assembly Version: 2.0.0.0<br>    Win32 Version: 2.0.50727.42 (RTM.050727-4200)<br>    CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Management/2.0.0.0__b03f5f7f11d50a3a/System.Management.dll<br>----------------------------------------<br>System.Data<br>    Assembly Version: 2.0.0.0<br>    Win32 Version: 2.0.50727.42 (RTM.050727-4200)<br>    CodeBase: file:///C:/WINDOWS/assembly/GAC_32/System.Data/2.0.0.0__b77a5c561934e089/System.Data.dll<br>----------------------------------------<br>Microsoft.SqlServer.Smo<br>    Assembly Version: 10.0.0.0<br>    Win32 Version: 10.0.1442.32 ((SQL_PreRelease).080529-2343 )<br>    CodeBase: file:///C:/Ab%20system%20info/Microsoft.SqlServer.Smo.DLL<br>----------------------------------------<br>System.Xml<br>    Assembly Version: 2.0.0.0<br>    Win32 Version: 2.0.50727.42 (RTM.050727-4200)<br>    CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Xml/2.0.0.0__b77a5c561934e089/System.Xml.dll<br>----------------------------------------<br>System.Transactions<br>    Assembly Version: 2.0.0.0<br>    Win32 Version: 2.0.50727.42 (RTM.050727-4200)<br>    CodeBase: file:///C:/WINDOWS/assembly/GAC_32/System.Transactions/2.0.0.0__b77a5c561934e089/System.Transactions.dll<br>----------------------------------------<br>System.EnterpriseServices<br>    Assembly Version: 2.0.0.0<br>    Win32 Version: 2.0.50727.42 (RTM.050727-4200)<br>    CodeBase: file:///C:/WINDOWS/assembly/GAC_32/System.EnterpriseServices/2.0.0.0__b03f5f7f11d50a3a/System.EnterpriseServices.dll<br>----------------------------------------<br>System.Configuration<br>    Assembly Version: 2.0.0.0<br>    Win32 Version: 2.0.50727.42 (RTM.050727-4200)<br>    CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Configuration/2.0.0.0__b03f5f7f11d50a3a/System.Configuration.dll<br>----------------------------------------<br>Microsoft.SqlServer.Management.Sdk.Sfc<br>    Assembly Version: 10.0.0.0<br>    Win32 Version: 10.0.1442.32 ((SQL_PreRelease).080529-2343 )<br>    CodeBase: file:///C:/Ab%20system%20info/Microsoft.SqlServer.Management.Sdk.Sfc.DLL<br>----------------------------------------<br>Microsoft.SqlServer.ConnectionInfo<br>    Assembly Version: 10.0.0.0<br>    Win32 Version: 10.0.1442.32 ((SQL_PreRelease).080529-2343 )<br>    CodeBase: file:///C:/Ab%20system%20info/Microsoft.SqlServer.ConnectionInfo.DLL<br>----------------------------------------<br><br><br></span></font>Thu, 14 Aug 2008 07:46:59 Z2009-11-30T06:08:00Zhttp://social.msdn.microsoft.com/Forums/en-US/sqlnetfx/thread/a63e33ba-bde4-4062-acb8-d06eb15d0889http://social.msdn.microsoft.com/Forums/en-US/sqlnetfx/thread/a63e33ba-bde4-4062-acb8-d06eb15d0889cafmhttp://social.msdn.microsoft.com/Profile/en-US/?user=cafmSQLFacet Return Precision and Scale in VB.NET 2005 fx2.0Hello, I've seem some examples on setting the SQLFacetAttribute on return values of SQLFunctions in C#. I can not make it work in VB.NET. The compiler always notes that this attribute can not be used on this declaration type. Does VB.Net 2005 lack this feature?Sun, 29 Nov 2009 19:54:16 Z2009-11-30T05:18:35Zhttp://social.msdn.microsoft.com/Forums/en-US/sqlnetfx/thread/81e596e4-1db3-41bd-bb00-0da33c1e38fdhttp://social.msdn.microsoft.com/Forums/en-US/sqlnetfx/thread/81e596e4-1db3-41bd-bb00-0da33c1e38fdParikhThttp://social.msdn.microsoft.com/Profile/en-US/?user=ParikhT.NET Framework execution was aborted by escalation policy because of out of memory.<span style="font-family:'Segoe UI', 'Lucida Grande', Verdana, Arial, Helvetica, sans-serif;font-size:13px;color:#333333;line-height:16px"> <div style="font-weight:inherit;font-style:inherit;font-family:inherit;padding:0px;margin:0px;border:0px initial initial">I've a similar issue with my SQL box. It's SQL 2005 ent edition. 9.0.4035. It's x64 with 32gb RAM.</div> <div style="font-weight:inherit;font-style:inherit;font-family:inherit;padding:0px;margin:0px;border:0px initial initial">I'm getting the error '.NET Framework execution was aborted by escalation policy because of out of memory.'</div> <div style="font-weight:inherit;font-style:inherit;font-family:inherit;padding:0px;margin:0px;border:0px initial initial">I was running an update statement at this time which was calling a function which was using clr.</div> <div style="font-weight:inherit;font-style:inherit;font-family:inherit;padding:0px;margin:0px;border:0px initial initial">I've also run your query above and below are the results.</div> <div style="font-weight:inherit;font-style:inherit;font-family:inherit;padding:0px;margin:0px;border:0px initial initial"> <div style="font-weight:inherit;font-style:inherit;font-family:inherit;padding:0px;margin:0px;border:0px initial initial">Total avail mem, KB<span style="font-weight:inherit;font-style:inherit;font-family:inherit;white-space:pre;padding:0px;margin:0px;border:0px initial initial"> </span>Max free size, KB</div> <div style="font-weight:inherit;font-style:inherit;font-family:inherit;padding:0px;margin:0px;border:0px initial initial">8532256848<span style="font-weight:inherit;font-style:inherit;font-family:inherit;white-space:pre;padding:0px;margin:0px;border:0px initial initial"> </span>6661828544</div> <div style="font-weight:inherit;font-style:inherit;font-family:inherit;padding:0px;margin:0px;border:0px initial initial"><br/></div> <div style="font-weight:inherit;font-style:inherit;font-family:inherit;padding:0px;margin:0px;border:0px initial initial">On my server, when I ran the memory consumption report, I see the following big numbers:</div> <div style="font-weight:inherit;font-style:inherit;font-family:inherit;padding:0px;margin:0px;border:0px initial initial">Component Type<span style="font-weight:inherit;font-style:inherit;font-family:inherit;white-space:pre;padding:0px;margin:0px;border:0px initial initial"> </span>Allocated Mem<span style="font-weight:inherit;font-style:inherit;font-family:inherit;white-space:pre;padding:0px;margin:0px;border:0px initial initial"> </span>Virt Mem Reserved<span style="font-weight:inherit;font-style:inherit;font-family:inherit;white-space:pre;padding:0px;margin:0px;border:0px initial initial"> </span>Virt Mem Committed<span style="font-weight:inherit;font-style:inherit;font-family:inherit;white-space:pre;padding:0px;margin:0px;border:0px initial initial"> </span>AWE mem Allocated</div> <div style="font-weight:inherit;font-style:inherit;font-family:inherit;padding:0px;margin:0px;border:0px initial initial">MemoryClerk_SQLCLR<span style="font-weight:inherit;font-style:inherit;font-family:inherit;white-space:pre;padding:0px;margin:0px;border:0px initial initial"> </span>21,520<span style="font-weight:inherit;font-style:inherit;font-family:inherit;white-space:pre;padding:0px;margin:0px;border:0px initial initial"> </span>23,344,384<span style="font-weight:inherit;font-style:inherit;font-family:inherit;white-space:pre;padding:0px;margin:0px;border:0px initial initial"> </span>16,977,220<span style="font-weight:inherit;font-style:inherit;font-family:inherit;white-space:pre;padding:0px;margin:0px;border:0px initial initial"> </span>0</div> <div style="font-weight:inherit;font-style:inherit;font-family:inherit;padding:0px;margin:0px;border:0px initial initial">MemClerk,SQLBUFFERPOOL<span style="font-weight:inherit;font-style:inherit;font-family:inherit;white-space:pre;padding:0px;margin:0px;border:0px initial initial"> </span>1,296<span style="font-weight:inherit;font-style:inherit;font-family:inherit;white-space:pre;padding:0px;margin:0px;border:0px initial initial"> </span>33,603,584<span style="font-weight:inherit;font-style:inherit;font-family:inherit;white-space:pre;padding:0px;margin:0px;border:0px initial initial"> </span>32,768<span style="font-weight:inherit;font-style:inherit;font-family:inherit;white-space:pre;padding:0px;margin:0px;border:0px initial initial"> </span>28,785,920</div> <div style="font-weight:inherit;font-style:inherit;font-family:inherit;padding:0px;margin:0px;border:0px initial initial"><br/></div> <div style="font-weight:inherit;font-style:inherit;font-family:inherit;padding:0px;margin:0px;border:0px initial initial">Right now, the server is running fine but the clr is not going to run anymore. I've to restart the server to get rid of the error. the assembly is created as SAFE.</div> <div style="font-weight:inherit;font-style:inherit;font-family:inherit;padding:0px;margin:0px;border:0px initial initial">I've also run DBCC FREESYSTEMCACHE('ALL') and the above numbers stayed pretty much the same. SQLCLR virt mem reservation went down by about 300mb and committed mem went down by about 100mb.</div> <div style="font-weight:inherit;font-style:inherit;font-family:inherit;padding:0px;margin:0px;border:0px initial initial"><br/></div> <div style="font-weight:inherit;font-style:inherit;font-family:inherit;padding:0px;margin:0px;border:0px initial initial">Please let me know if something else comes to your mind that we can try.</div> <div style="font-weight:inherit;font-style:inherit;font-family:inherit;padding:0px;margin:0px;border:0px initial initial">Thank you.</div> </div> </span>Wed, 25 Nov 2009 21:28:42 Z2009-11-30T03:41:12Zhttp://social.msdn.microsoft.com/Forums/en-US/sqlnetfx/thread/46222a79-7f1d-4c52-87c3-0ba0b5758d9bhttp://social.msdn.microsoft.com/Forums/en-US/sqlnetfx/thread/46222a79-7f1d-4c52-87c3-0ba0b5758d9bpkellnerhttp://social.msdn.microsoft.com/Profile/en-US/?user=pkellnerMy First Rodeo in the .Net CLR, not going so wellI'm trying to create a trigger that fires after a row is inserted in my Log4Net table.  Specifically, I store some JSON in the 4000 character (VARCHAR) field of log4net, and I want to parse that (using NewtonSoft) and insert an companion record in a second table with the results of the parse.  I'm not too far down the path yet and am getting a funny error.<br/><br/>I'm pasting my simple code, and the error I'm getting is: &quot;INSERT INTO dbo.Lo4gNetDataMart(Log4NetId,MessageLine1) VALUES(@Id,'YeeHa!')&quot;<br/><br/> <pre lang="x-c#">using System.Data.SqlClient; using System.Text.RegularExpressions; using Microsoft.SqlServer.Server; public partial class Triggers { [SqlTrigger(Name = &quot;Log4NetParse&quot;, Target = &quot;Log4Net&quot;, Event = &quot;FOR INSERT&quot;)] public static void Log4NetParse() { var triggContext = SqlContext.TriggerContext; var log4NetId = new SqlParameter(&quot;@Id&quot;, System.Data.SqlDbType.Int); if (triggContext.TriggerAction == TriggerAction.Insert) { using (var conn = new SqlConnection(&quot;context connection=true&quot;)) { conn.Open(); var sqlComm = new SqlCommand(); var sqlP = SqlContext.Pipe; sqlComm.Connection = conn; sqlComm.CommandText = &quot;SELECT Id from INSERTED&quot;; log4NetId.Value = sqlComm.ExecuteScalar().ToString(); sqlComm.CommandText = string.Format( &quot;INSERT INTO dbo.Log4NetDataMart(Log4NetId,MessageLine1) VALUES({0},'{1}')&quot;, log4NetId,&quot;YeeHa!&quot;); sqlP.Send(sqlComm.CommandText); sqlP.ExecuteAndSend(sqlComm); } } } }</pre> and my table DDDL's.<br/><br/> <pre lang=x-sql>CREATE TABLE [dbo].[Log4Net] ( [Id] int IDENTITY(1, 1) NOT NULL, [Date] datetime NOT NULL, [Thread] varchar(255) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL, [Level] varchar(50) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL, [Logger] varchar(255) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL, [Message] varchar(4000) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL, [Exception] varchar(2000) COLLATE SQL_Latin1_General_CP1_CI_AS NULL, CONSTRAINT [Log4Net_pk] PRIMARY KEY CLUSTERED ([Id]) ) ON [PRIMARY] GO CREATE NONCLUSTERED INDEX [Log4Net_idx] ON [dbo].[Log4Net] ([Date]) WITH ( PAD_INDEX = OFF, DROP_EXISTING = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] GO CREATE TRIGGER [dbo].[Log4NetParse] ON [dbo].[Log4Net] WITH EXECUTE AS CALLER FOR INSERT AS EXTERNAL NAME [ThreePLogicAccess.SqlServerCLR].[Triggers].[Log4NetParse] GO CREATE TABLE [dbo].[Log4NetDataMart] ( [Id] int IDENTITY(1, 1) NOT NULL, [Log4NetId] int NOT NULL, [LoadId] int NULL, [ShippingOrderId] int NULL, [CargoId] int NULL, [GlobalSolutionId] int NULL, [ColemanProNumber] nvarchar(64) COLLATE SQL_Latin1_General_CP1_CI_AS NULL, [ColemanPTCN] nvarchar(64) COLLATE SQL_Latin1_General_CP1_CI_AS NULL, [ColemanFtpStagingId] int NULL, [CargoSetId] int NULL, [CompanyId] int NULL, [UsersId] int NULL, [UserName] varchar(256) COLLATE SQL_Latin1_General_CP1_CI_AS NULL, [FileNameProcessed] varchar(256) COLLATE SQL_Latin1_General_CP1_CI_AS NULL, [EllapsedTime] int NULL, [MessageLine1] varchar(256) COLLATE SQL_Latin1_General_CP1_CI_AS NULL, [MessageLine2] varchar(256) COLLATE SQL_Latin1_General_CP1_CI_AS NULL, CONSTRAINT [Log4NetDataMart_PK] PRIMARY KEY CLUSTERED ([Id]), CONSTRAINT [Log4NetDataMart_fk] FOREIGN KEY ([Log4NetId]) REFERENCES [dbo].[Log4Net] ([Id]) ON UPDATE NO ACTION ON DELETE NO ACTION ) ON [PRIMARY] GO</pre> <br/><hr class="sig">Peter Kellner http://peterkellner.net Microsoft MVP • ASPInsider Sun, 29 Nov 2009 22:07:18 Z2009-11-30T00:28:38Zhttp://social.msdn.microsoft.com/Forums/en-US/sqlnetfx/thread/85921abb-740f-4212-95a5-2bec8af44f6ahttp://social.msdn.microsoft.com/Forums/en-US/sqlnetfx/thread/85921abb-740f-4212-95a5-2bec8af44f6aJarinBabyhttp://social.msdn.microsoft.com/Profile/en-US/?user=JarinBabyDoubt on Stored Procedure<div>ALTER PROCEDURE sp_GetBoothNo</div> <div><span style="white-space:pre"> </span>(@BoothSize varchar(max))</div> <div>AS</div> <div><span style="white-space:pre"> </span>begin</div> <div><span style="white-space:pre"> </span>declare @Sum int</div> <div><span style="white-space:pre"> </span>select @Sum=sum(NoOfBooth) From TblBooth where BoothSize=@BoothSize</div> <div><span style="white-space:pre"> </span>if(@Sum == null)</div> <div><span style="white-space:pre"> </span>begin</div> <div><span style="white-space:pre"> </span>set @Sum = 0</div> <div><span style="white-space:pre"> </span>end</div> <div><span style="white-space:pre"> </span>select @Sum</div> <div><span style="white-space:pre"> </span>end</div> <div><span style="white-space:pre"> </span>RETURN</div> <div>how can i compare using if statement like this</div>Sun, 29 Nov 2009 09:07:08 Z2009-11-29T14:41:36Zhttp://social.msdn.microsoft.com/Forums/en-US/sqlnetfx/thread/73f63bfb-ed9c-47af-91e1-8b2f8a06f690http://social.msdn.microsoft.com/Forums/en-US/sqlnetfx/thread/73f63bfb-ed9c-47af-91e1-8b2f8a06f690OlegKomarovhttp://social.msdn.microsoft.com/Profile/en-US/?user=OlegKomarovCLR UDA debugI found on <a href="http://blogs.solidq.com/EN/dsarka/Lists/Posts/Post.aspx?List=871e778d-7617-45b7-a6ce-7b8215ed5aea&amp;ID=37">Check here</a> this code for skewness and kurtosis: <pre lang="x-c#">using System; using System.Data; using System.Data.SqlClient; using System.Data.SqlTypes; using Microsoft.SqlServer.Server; [Serializable] [SqlUserDefinedAggregate( Format.Native, IsInvariantToDuplicates = false, IsInvariantToNulls = true, IsInvariantToOrder = true, IsNullIfEmpty = false)] public struct Skew { private double rx; // running sum of current values (x) private double rx2; // running sum of squared current values (x^2) private double r2x; // running sum of doubled current values (2x) private double rx3; // running sum of current values raised to power 3 (x^3) private double r3x2; // running sum of tripled squared current values (3x^2) private double r3x; // running sum of tripled current values (3x) private Int64 rn; // running count of rows public void Init() { rx = 0; rx2 = 0; r2x = 0; rx3 = 0; r3x2 = 0; r3x = 0; rn = 0; } public void Accumulate(SqlDouble inpVal) { if (inpVal.IsNull) { return; } rx = rx + inpVal.Value; rx2 = rx2 + Math.Pow(inpVal.Value, 2); r2x = r2x + 2 * inpVal.Value; rx3 = rx3 + Math.Pow(inpVal.Value, 3); r3x2 = r3x2 + 3 * Math.Pow(inpVal.Value, 2); r3x = r3x + 3 * inpVal.Value; rn = rn + 1; } public void Merge(Skew Group) { this.rx = this.rx + Group.rx; this.rx2 = this.rx2 + Group.rx2; this.r2x = this.r2x + Group.r2x; this.rx3 = this.rx3 + Group.rx3; this.r3x2 = this.r3x2 + Group.r3x2; this.r3x = this.r3x + Group.r3x; this.rn = this.rn + Group.rn; } public SqlDouble Terminate() { double myAvg = (rx / rn); double myStDev = Math.Pow((rx2 - r2x * myAvg + rn * Math.Pow(myAvg, 2)) / (rn - 1), 1d / 2d); double mySkew = (rx3 - r3x2 * myAvg + r3x * Math.Pow(myAvg, 2) - rn * Math.Pow(myAvg, 3)) / Math.Pow(myStDev,3) * rn / (rn - 1) / (rn - 2); return (SqlDouble)mySkew; } } [Serializable] [SqlUserDefinedAggregate( Format.Native, IsInvariantToDuplicates = false, IsInvariantToNulls = true, IsInvariantToOrder = true, IsNullIfEmpty = false)] public struct Kurt { private double rx; // running sum of current values (x) private double rx2; // running sum of squared current values (x^2) private double r2x; // running sum of doubled current values (2x) private double rx4; // running sum of current values raised to power 4 (x^4) private double r4x3; // running sum of quadrupled current values raised to power 3 (4x^3) private double r6x2; // running sum of squared current values multiplied by 6 (6x^2) private double r4x; // running sum of quadrupled current values (4x) private Int64 rn; // running count of rows public void Init() { rx = 0; rx2 = 0; r2x = 0; rx4 = 0; r4x3 = 0; r6x2 = 0; r4x = 0; rn = 0; } public void Accumulate(SqlDouble inpVal) { if (inpVal.IsNull) { return; } rx = rx + inpVal.Value; rx2 = rx2 + Math.Pow(inpVal.Value, 2); r2x = r2x + 2 * inpVal.Value; rx4 = rx4 + Math.Pow(inpVal.Value, 4); r4x3 = r4x3 + 4 * Math.Pow(inpVal.Value, 3); r6x2 = r6x2 + 6 * Math.Pow(inpVal.Value, 2); r4x = r4x + 4 * inpVal.Value; rn = rn + 1; } public void Merge(Kurt Group) { this.rx = this.rx + Group.rx; this.rx2 = this.rx2 + Group.rx2; this.r2x = this.r2x + Group.r2x; this.rx4 = this.rx4 + Group.rx4; this.r4x3 = this.r4x3 + Group.r4x3; this.r6x2 = this.r6x2 + Group.r6x2; this.r4x = this.r4x + Group.r4x; this.rn = this.rn + Group.rn; } public SqlDouble Terminate() { double myAvg = (rx / rn); double myStDev = Math.Pow((rx2 - r2x * myAvg + rn * Math.Pow(myAvg, 2)) / (rn - 1), 1d / 2d); double myKurt = (rx4 - r4x3 * myAvg + r6x2 * Math.Pow(myAvg, 2) - r4x * Math.Pow(myAvg, 3) + rn * Math.Pow(myAvg, 4)) / Math.Pow(myStDev, 4) * rn * (rn + 1) / (rn - 1) / (rn - 2) / (rn - 3) - 3 * Math.Pow((rn - 1), 2) / (rn - 2) / (rn - 3); return (SqlDouble)myKurt; } } </pre> I compiled it to a .dll file with MS Visual C# 2008 Express Edition.<br/> <br/> Then i added the CLR UDA with the following code:<br/> <pre lang=x-sql>-- Skewness and Kurtosis with UDAs USE AdventureWorksDW; GO EXEC sp_configure 'clr enabled', 1; RECONFIGURE WITH OVERRIDE; GO -- Load CS Assembly CREATE ASSEMBLY DescriptiveStatistics FROM 'yourpath\yourdllname.dll' WITH PERMISSION_SET = SAFE; GO -- Create the aggregates CREATE AGGREGATE dbo.Skew(@s float) RETURNS float EXTERNAL NAME DescriptiveStatistics.Skew; GO CREATE AGGREGATE dbo.Kurt(@s float) RETURNS float EXTERNAL NAME DescriptiveStatistics.Kurt; GO </pre> I can use the aggregation skew and kurt freely but i have found two issues:<br/> <br/> [FIRST ISSUE]<br/> <br/> SELECT  dbo.Skew(Field) AS Skew, dbo.Kurt(Field) AS Kurt<br/> FROM     MyTable<br/> WHERE  (Cond1 = 378) AND (Cond2 = 2008)<br/> <br/> Msg 6522, Level 16, State 2, Line 1<br/> A .NET Framework error occurred during execution of user-defined routine or aggregate &quot;Skew&quot;: <br/> System.OverflowException: Arithmetic Overflow.<br/> System.OverflowException: <br/>    at System.Data.SqlTypes.SqlDouble..ctor(Double value)<br/>    at System.Data.SqlTypes.SqlDouble.op_Implicit(Double x)<br/>    at Skew.Terminate().<br/> <br/> where <br/> <br/> SELECT * FROM MyTable<br/> WHERE  (Cond1 = 378) AND (Cond2 = 2008)<br/> <br/> returns no rows (empty result)<br/> <br/> I'm using SSMS 2008. <br/> I compiled the code as a .dll with MS Visual C# Express Edition.<br/> <br/> <br/> [SECOND ISSUE]<br/> Kurtosis on a set of values returns: 1585.68<br/> <br/> The kurtosis function with matlab returns instead: 1588.69<br/> Without sample bias correction: 1588.65<br/> <br/> Can it be an error in the CLR formula for kurtosis?<br/> <br/> <br/> If somebody can help me to solve this issues (since i don't have C# programming skills) i'm sure the Whole MS SQL community will be thankful.<br/> <br/> THANKS IN ADVANCE <br/> <br/> Oleg Komarov<br/> <br/> <br/>Fri, 27 Nov 2009 15:42:42 Z2009-11-27T20:00:44Zhttp://social.msdn.microsoft.com/Forums/en-US/sqlnetfx/thread/5d4cede9-b674-451a-a4e8-1e2d239a923ahttp://social.msdn.microsoft.com/Forums/en-US/sqlnetfx/thread/5d4cede9-b674-451a-a4e8-1e2d239a923aML90http://social.msdn.microsoft.com/Profile/en-US/?user=ML90Create Assembly from .NET dllI am using a the SharpSvn dll open source.  I want to deploy it through a CLR function, but I first need to manually create it in sql server on the database so I can reference the dll in my CLR project.  I have searched around intensively and could not find a solution to work.  This is what I am attempting:<br/><br/> <p class=MsoNormal style="margin:0in 0in 0pt;line-height:normal"><span style="font-size:10pt;color:blue;font-family:'Courier New'">USE</span><span style="font-size:10pt;font-family:'Courier New'"> MyDb</span></p> <p class=MsoNormal style="margin:0in 0in 0pt;line-height:normal"><span style="font-size:10pt;font-family:'Courier New'"> </span></p> <p class=MsoNormal style="margin:0in 0in 0pt;line-height:normal"><span style="font-size:10pt;color:blue;font-family:'Courier New'">ALTER</span><span style="font-size:10pt;font-family:'Courier New'"> <span style="color:blue">DATABASE</span> MyDb<span style="color:blue"> SET</span> <span style="color:blue">TRUSTWORTHY</span> <span style="color:blue">ON</span></span></p> <p class=MsoNormal style="margin:0in 0in 0pt;line-height:normal"><span style="font-size:10pt;color:blue;font-family:'Courier New'"> </span></p> <p class=MsoNormal style="margin:0in 0in 0pt;line-height:normal"><span style="font-size:10pt;color:blue;font-family:'Courier New'">CREATE</span><span style="font-size:10pt;font-family:'Courier New'"> <span style="color:blue">ASSEMBLY</span> SharpSvn</span></p> <p class=MsoNormal style="margin:0in 0in 0pt;line-height:normal"><span style="font-size:10pt;color:blue;font-family:'Courier New'">FROM</span><span style="font-size:10pt;font-family:'Courier New'"> <span style="color:red">'C:\SharpSvn\SharpSvn.dll'</span></span></p> <p class=MsoNormal style="margin:0in 0in 10pt"><span style="font-size:10pt;color:blue;line-height:115%;font-family:'Courier New'">WITH</span><span style="font-size:10pt;line-height:115%;font-family:'Courier New'"> <span style="color:blue">PERMISSION_SET</span> <span style="color:gray">=</span> <span style="color:blue">UNSAFE<br/><br/></span></span></p> <p class=MsoNormal style="margin:0in 0in 10pt"><span style="font-size:small;color:#000000;font-family:Calibri">This is the error that occurs:</span></p> <p class=MsoNormal style="margin:0in 0in 10pt"><span style="font-size:small;color:#000000;font-family:Calibri"> </span></p> <p class=MsoNormal style="margin:0in 0in 0pt;line-height:normal"><span style="font-size:8pt;font-family:'Courier New'"><span style="color:#000000">Msg 6218, Level 16, State 3, Line 2</span></span></p> <p class=MsoNormal style="margin:0in 0in 0pt;line-height:normal"><span style="font-size:8pt;font-family:'Courier New'"><span style="color:#000000">CREATE ASSEMBLY for assembly 'SharpSvn' failed because assembly 'SharpSvn' failed verification. Check if the referenced assemblies are up-to-date and trusted (for external_access or unsafe) to execute in the database. CLR Verifier error messages if any will follow this message</span></span></p> <p class=MsoNormal style="margin:0in 0in 10pt"> </p> <p class=MsoNormal style="margin:0in 0in 10pt"><span style="font-size:small;color:#000000;font-family:Calibri">Any tips would be greatly appreciated.<span style="">  </span>Thanks</span></p>Wed, 25 Nov 2009 21:17:54 Z2009-11-26T00:02:27Zhttp://social.msdn.microsoft.com/Forums/en-US/sqlnetfx/thread/85c1d787-dcd8-4f85-96c9-e8f6882620dchttp://social.msdn.microsoft.com/Forums/en-US/sqlnetfx/thread/85c1d787-dcd8-4f85-96c9-e8f6882620dckkdhfhttp://social.msdn.microsoft.com/Profile/en-US/?user=kkdhfhow to send message to external message queue in a trigger of sql server ?<p>i write a code to send message to windows message queue,but when i try to add it to clr but failed for need to reference other dll like system.messaging.dll , and when i try to add this dll first, but it need other dll ,too. so i tired to add these dll, and want to know how to <br/>send message to message queue, maybe i'm wrong , maybe there's better way. so ,i hope someone can help me to solve this.<br/>code :<br/> public class MSGQSpiderTrigger<br/>    {<br/>        public void ExportToMSG()<br/>        {<br/>            SqlTriggerContext sqlTrigger = SqlContext.TriggerContext;<br/>            SqlDataReader reader;<br/>            SqlCommand command;<br/>            MSGDocInfo doc = new MSGDocInfo();<br/>            if (sqlTrigger.TriggerAction == TriggerAction.Insert)<br/>            {<br/>                <br/>                using (SqlConnection connection  = new SqlConnection(@&quot;context connection=true&quot;))<br/>                {<br/>                    connection.Open();<br/>                    command = new SqlCommand(@&quot;SELECT * FROM INSERTED;&quot;, connection);<br/>                    reader = command.ExecuteReader();<br/>                    reader.Read();<br/>                   //.... read my data<br/><br/>                    reader.Close();<br/>                }</p> <p>                  //then send to windows message queue.  <br/>              MessageQueueManager.SendMsg(MessageQueueManager.GetMsgQueue(), doc);<br/>            }<br/>        }<br/>    }</p>Sun, 22 Nov 2009 03:36:49 Z2009-11-30T10:07:45Zhttp://social.msdn.microsoft.com/Forums/en-US/sqlnetfx/thread/cc1b3e43-0db8-4e75-b5ab-bc2a4c93b12bhttp://social.msdn.microsoft.com/Forums/en-US/sqlnetfx/thread/cc1b3e43-0db8-4e75-b5ab-bc2a4c93b12bAvi Ghttp://social.msdn.microsoft.com/Profile/en-US/?user=Avi%20Ghelp with this AppDomain event<p align=left><span class=spnMessageText id=msg><font color="#191970">Hi,<br><br>I've a company that use SQL CLR from IIS that connect to the SQL and insert data to tables.<br>every few days the server stop responding and i see those error in the sql event viewer<br>Unsafe assembly 'hebfilts, version=0.0.0.0, culture=neutral, publickeytoken=null, processorarchitecture=msil' loaded into appdomain 9 (system.dbo[runtime].8).<br><br>AppDomain 9 (system.dbo[runtime].8) unloaded.<br>AppDomain 9 (system.dbo[runtime].8) is marked for unload due to memory pressure.<br><br>the problem is fixed only when i restart the sql server service.<br>now i use SQl Server 2005 SP2 build 9.0.3042<br>I've found an article that talks about this problem but they say that it fix in build 2153 </font><a href="http://support.microsoft.com/kb/917271"><font color="#0000ff">http://support.microsoft.com/kb/917271</font></a><br><font color="#191970">and i'v 3042.<br>does my build include this fix?(i installed sp2 after RTM)<br>if so how can i fix this error that i have? <br><br>THX</font><br></span></p>Tue, 27 May 2008 14:20:34 Z2009-11-25T21:06:12Zhttp://social.msdn.microsoft.com/Forums/en-US/sqlnetfx/thread/f45e50c5-2a39-4915-ad00-808afccd9a3dhttp://social.msdn.microsoft.com/Forums/en-US/sqlnetfx/thread/f45e50c5-2a39-4915-ad00-808afccd9a3dtsreeramhttp://social.msdn.microsoft.com/Profile/en-US/?user=tsreeramHow to avoid network problems while calling a webservice in a SQL CLR trigger?Hi All,<br/> <br/> My Goal: DB synchronization between SQL server 2005 and Mysql database via web services.<br/> <br/> I have created a SQLCLR trigger, in which i'm calling a web service to sync/update remote (MYSQL) DB over a specific constraints. After getting the acknowledgment from web service i'm updating the sync flag to success (In SQL SERVER2005). If any network delay happens i am unable to know whether sync has done successfully or not.<br/> <br/> How to avoid network dependency here?<br/> <br/> Is there any reliable queuing mechanism available in sql server 2005 to eliminate dependency over network?<br/> <br/> I am looking any suitable service/approach in sql server 2005 that can take care of calling web services as asynchronously and update the status of sync flag irrespective of network.<br/> <br/> <br/> Thanks in advance if anyone provide the good approach as step by step in detail.<br/>   <br/> <br/>Thu, 19 Nov 2009 14:39:07 Z2009-11-30T09:47:34Zhttp://social.msdn.microsoft.com/Forums/en-US/sqlnetfx/thread/2c8b94dd-cfa7-40bb-9406-694006117c6fhttp://social.msdn.microsoft.com/Forums/en-US/sqlnetfx/thread/2c8b94dd-cfa7-40bb-9406-694006117c6fkmbayahttp://social.msdn.microsoft.com/Profile/en-US/?user=kmbayaencrypt password and salt in sql server 2008 using an external key from web.configI'm using a sql membership provider which saves the password and passwordsalt in the database ok using the machine key define in my web.config. I would like to encrypt the provided clear text password from sql server to see if I get the same stored password.<br/>  &lt;machineKey validationKey=&quot;E94B2016343177A8D5EC48B1B71B9B77C1B5CC5DFDA0B619541CC85F4AAA40F79B09B22481279DB6CFEF4895D525F41587F517269D50127E83167614D18A02AC&quot; decryptionKey=&quot;E9B358945877F8262649EC7FC7B9ECB190BDCAEADEA0B84F11A51F8FAB8EB889&quot; validation=&quot;SHA1&quot; decryption=&quot;AES&quot;/&gt;<br/><br/>Encrypted password:   <span style="font-size:x-small;color:#008000"><span style="font-size:x-small;color:#008000">LGemmlj7of9bCTsayS8xA6yaokkEEZuyArvDEisBYbUAjiR5rm4nRpoaEJ13l+Kc<br/><br/>password salt:     <span style="font-size:x-small;color:#008000"><span style="font-size:x-small;color:#008000">15xCCPpCp7mB3AsDKrz0Z/w=<br/></span></span><br/>original clear text password: bakishi1<br/><br/>How do you write a query in sql server 2008 using the clear text password,the machine key, and salt password to come up with the same encrypted password.<br/><br/><br/></span></span>Thu, 19 Nov 2009 18:03:19 Z2009-11-30T09:51:05Zhttp://social.msdn.microsoft.com/Forums/en-US/sqlnetfx/thread/00ccc550-3e24-481f-ba74-c525771b5ac1http://social.msdn.microsoft.com/Forums/en-US/sqlnetfx/thread/00ccc550-3e24-481f-ba74-c525771b5ac1Craigsterhttp://social.msdn.microsoft.com/Profile/en-US/?user=CraigsterGetting the name of the updated table<p>I am writing a generic trigger in VS 2005 that selects records from the inserted table, and updates an audit table. I am, however, unable to retrieve the name of the table that the insert occurred on. I am using the following code to select the records, and obtain the name.. Can anyone offer any alternatives to accomplishing this task? Thanks in advnace for any help you can provide. </p> <p>Craig</p> <p><font color="#008080" size=1>SqlDataAdapter</font><font size=1> tableLoader = </font><font color="#0000ff" size=1>new</font><font size=1> </font><font color="#008080" size=1>SqlDataAdapter</font><font size=1>(</font><font color="#800000" size=1>&quot;SELECT * FROM inserted&quot;</font><font size=1>, connection);</p> <p></font><font color="#008080" size=1>DataTable</font><font size=1> insertedTable = </font><font color="#0000ff" size=1>new</font><font size=1> </font><font color="#008080" size=1>DataTable</font><font size=1>();</p> <p>tableLoader.Fill(insertedTable);</p> <p></font><font color="#0000ff" size=1>string</font><font size=1> insertedTableName = insertedTable.TableName;</font></p> <p><font size=1> </p></font>Tue, 07 Mar 2006 15:04:53 Z2009-11-18T23:31:39Zhttp://social.msdn.microsoft.com/Forums/en-US/sqlnetfx/thread/4c2a1733-34fa-4441-bccb-24fc7da7a4f2http://social.msdn.microsoft.com/Forums/en-US/sqlnetfx/thread/4c2a1733-34fa-4441-bccb-24fc7da7a4f2MatthieuMEZIL-MVPhttp://social.msdn.microsoft.com/Profile/en-US/?user=MatthieuMEZIL-MVPCLR Function and Persisted Computed Columns<p>Hi,</p> <p>I have the following C# method:</p> <p>[SqlFunction(IsDeterministic = true)]<br/>public static SqlInt16 GetNumber(SqlString id)<br/>{<br/>    return new SqlInt16(short.Parse(Regex.Match(id.Value, &quot;^[0-9]{2,3}&quot;).Value));<br/>}</p> <p>I import it on my DB. It works well.<br/>But even if I used the property attribute IsDeterministic = true in my C# code, I can't do this:</p> <p>ALTER TABLE Cars<br/>ADD Number AS dbo.GetNumber(Id) Persisted</p> <p>I still have an error: Computed column 'Number' in table 'Cars' cannot be persisted because the column is non-deterministic.</p> <p>So what can I do to have a Persisted Computed Column which uses a CLR functions?<br/>(I use SQL Server 2008 SP1).</p> <p>Thanks</p> <p>Matthieu</p>Wed, 18 Nov 2009 20:47:02 Z2009-11-18T23:00:09Zhttp://social.msdn.microsoft.com/Forums/en-US/sqlnetfx/thread/6ff8d718-c552-48e3-b007-3ef166fadfechttp://social.msdn.microsoft.com/Forums/en-US/sqlnetfx/thread/6ff8d718-c552-48e3-b007-3ef166fadfecmaroxhttp://social.msdn.microsoft.com/Profile/en-US/?user=maroxclr sql in vs c++Hello, i have a problem<br/> <br/> i must use external dll in clr dll file, for example<br/> myDLL.dll contain function int add (int, int)<br/> <br/> in CLR project (myCLR.dll) i have function<br/> int clr_add (int, int){<br/> <br/> }<br/> <br/> Problem: in clr_add i must use function from myDLL.dll<br/> is it possible? how can i registry in myCLR.clr_add function form myDLL.dll?Tue, 10 Nov 2009 14:06:27 Z2009-11-19T09:36:17Zhttp://social.msdn.microsoft.com/Forums/en-US/sqlnetfx/thread/b21cabbc-6c40-40ba-98b3-87754b365d0fhttp://social.msdn.microsoft.com/Forums/en-US/sqlnetfx/thread/b21cabbc-6c40-40ba-98b3-87754b365d0fHelio Dhttp://social.msdn.microsoft.com/Profile/en-US/?user=Helio%20DProblems with Accumulate method when attempting to create a CLR Aggregation in SQL Server 2005I am getting an error with the Accumulate method of my my aggreagation class. Any help to solve this problem would be greatly appreciated.<br/><br/>Here is some information:<br/><br/>(1) I created an assembly in MS Visual Studio 2008 containing a user defined aggregate function.<br/><br/>(2) I deployed the assembly to SQL 2005 from SSMS.<br/><br/>(3) When I attempt to create the aggregate function I have the following error message:<br/><br/> <p class=MsoNormal style="margin:0cm 0cm 0pt"><span style="font-family:'Courier New';font-size:8pt">Msg 6558, Level 16, State 1, Line 1</span></p> <p class=MsoNormal style="margin:0cm 0cm 0pt"><span style="font-family:'Courier New';font-size:8pt">CREATE AGGREGATE failed because type 'CountryLocation' does not conform to UDAGG specification due to method 'Accumulate'.</span></p> <p class=MsoNormal style="margin:0cm 0cm 0pt"><span style="font-family:'Courier New';font-size:8pt">Msg 6597, Level 16, State 2, Line 1</span></p> <p class=MsoNormal style="margin:0cm 0cm 0pt"><span style="font-family:'Courier New';font-size:8pt">CREATE AGGREGATE failed.<br/><br/>(4) My CREATE AGGREGATE statement is :<br/></span></p> <p class=MsoNormal style="margin:0cm 0cm 0pt"><span style="font-family:'Courier New';color:blue;font-size:10pt">CREATE</span><span style="font-family:'Courier New';font-size:10pt"> <span style="color:blue">AGGREGATE</span> CountryLocation<span style="color:gray">(</span>@Value <span style="color:blue">varchar</span><span style="color:gray">(</span>20<span style="color:gray">))</span></span></p> <p class=MsoNormal style="margin:0cm 0cm 0pt"><span style="font-family:'Courier New';color:blue;font-size:10pt">RETURNS</span><span style="font-family:'Courier New';font-size:10pt"> <span style="color:blue">varchar</span><span style="color:gray">(</span>10<span style="color:gray">)</span></span></p> <p class=MsoNormal style="margin:0cm 0cm 0pt"><span style="font-family:'Courier New';color:blue;font-size:10pt">EXTERNAL</span><span style="font-family:'Courier New';font-size:10pt"> <span style="color:blue">NAME</span> MySqlUdf<span style="color:gray">.</span>CountryLocation<span style="color:gray">;<br/></span></span></p> <p class=MsoNormal style="margin:0cm 0cm 0pt"><br/>(5) The source code for my aggregate function is below. It is a simple code that I am using to learn about user defined aggregation. In essence, it reads a country record with the possible values Russia, Japan, Australia and New Zealand. The aggregation is supposed to indicated if the country is located on the North or South hemisphere. For example, if the countries read are Russia and Japan then the aggregate value is 'North'.<br/><br/>Here's the code:</p> <p class=MsoNormal style="margin:0cm 0cm 0pt"><span style="font-family:'Courier New';color:blue;font-size:10pt">using</span><span style="font-family:'Courier New';font-size:10pt"> System;</span></p> <p class=MsoNormal style="margin:0cm 0cm 0pt"><span style="font-family:'Courier New';color:blue;font-size:10pt">using</span><span style="font-family:'Courier New';font-size:10pt"> System.Data;</span></p> <p class=MsoNormal style="margin:0cm 0cm 0pt"><span style="font-family:'Courier New';color:blue;font-size:10pt">using</span><span style="font-family:'Courier New';font-size:10pt"> Microsoft.SqlServer.Server;</span></p> <p class=MsoNormal style="margin:0cm 0cm 0pt"><span style="font-family:'Courier New';color:blue;font-size:10pt">using</span><span style="font-family:'Courier New';font-size:10pt"> System.Data.SqlTypes;</span></p> <p class=MsoNormal style="margin:0cm 0cm 0pt"><span style="font-family:'Courier New';color:blue;font-size:10pt">using</span><span style="font-family:'Courier New';font-size:10pt"> System.IO;</span></p> <p class=MsoNormal style="margin:0cm 0cm 0pt"><span style="font-family:'Courier New';color:blue;font-size:10pt">using</span><span style="font-family:'Courier New';font-size:10pt"> System.Text;</span></p> <p class=MsoNormal style="margin:0cm 0cm 0pt"><span style="font-family:'Courier New';font-size:10pt"> </span></p> <p class=MsoNormal style="margin:0cm 0cm 0pt"><span style="font-family:'Courier New';font-size:10pt">[<span style="color:#2b91af">Serializable</span>]</span></p> <p class=MsoNormal style="margin:0cm 0cm 0pt"><span style="font-family:'Courier New';font-size:10pt">[<span style="color:#2b91af">SqlUserDefinedAggregate</span>(</span></p> <p class=MsoNormal style="margin:0cm 0cm 0pt"><span style="font-family:'Courier New';font-size:10pt">    <span style="color:#2b91af">Format</span>.UserDefined, <span style="color:green">//use clr serialization to serialize the intermediate result</span></span></p> <p class=MsoNormal style="margin:0cm 0cm 0pt"><span style="font-family:'Courier New';font-size:10pt">    IsInvariantToNulls = <span style="color:blue">true</span>, <span style="color:green">//optimizer property</span></span></p> <p class=MsoNormal style="margin:0cm 0cm 0pt"><span style="font-family:'Courier New';font-size:10pt">    IsInvariantToDuplicates = <span style="color:blue">false</span>, <span style="color:green">//optimizer property</span></span></p> <p class=MsoNormal style="margin:0cm 0cm 0pt"><span style="font-family:'Courier New';font-size:10pt">    IsInvariantToOrder = <span style="color:blue">false</span>, <span style="color:green">//optimizer property</span></span></p> <p class=MsoNormal style="margin:0cm 0cm 0pt"><span style="font-family:'Courier New';font-size:10pt">    MaxByteSize = 8000) <span style="color:green">//maximum size in bytes of persisted value</span></span></p> <p class=MsoNormal style="margin:0cm 0cm 0pt"><span style="font-family:'Courier New';font-size:10pt">]</span></p> <p class=MsoNormal style="margin:0cm 0cm 0pt"><span style="font-family:'Courier New';color:blue;font-size:10pt">public</span><span style="font-family:'Courier New';font-size:10pt"> <span style="color:blue">class</span> <span style="color:#2b91af">CountryLocation</span> : <span style="color:#2b91af">IBinarySerialize</span> </span></p> <p class=MsoNormal style="margin:0cm 0cm 0pt"><span style="font-family:'Courier New';font-size:10pt"> </span></p> <p class=MsoNormal style="margin:0cm 0cm 0pt"><span style="font-family:'Courier New';font-size:10pt">  {</span></p> <p class=MsoNormal style="margin:0cm 0cm 0pt"><span style="font-family:'Courier New';font-size:10pt">    <span style="color:blue">private</span> <span style="color:#2b91af">SqlString</span> _location;</span></p> <p class=MsoNormal style="margin:0cm 0cm 0pt"><span style="font-family:'Courier New';font-size:10pt"> </span></p> <p class=MsoNormal style="margin:0cm 0cm 0pt"><span style="font-family:'Courier New';font-size:10pt">    <span style="color:blue">public</span> <span style="color:blue">void</span> Init()</span></p> <p class=MsoNormal style="margin:0cm 0cm 0pt"><span style="font-family:'Courier New';font-size:10pt">    {</span></p> <p class=MsoNormal style="margin:0cm 0cm 0pt"><span style="font-family:'Courier New';font-size:10pt">      _location = <span style="color:#a31515">&quot;Unknown&quot;</span>;</span></p> <p class=MsoNormal style="margin:0cm 0cm 0pt"><span style="font-family:'Courier New';font-size:10pt">    }</span></p> <p class=MsoNormal style="margin:0cm 0cm 0pt"><span style="font-family:'Courier New';font-size:10pt"> </span></p> <p class=MsoNormal style="margin:0cm 0cm 0pt"><span style="font-family:'Courier New';font-size:10pt">    <span style="color:blue">public</span> <span style="color:blue">void</span> Accumulate(<span style="color:#2b91af">SqlString</span> value)</span></p> <p class=MsoNormal style="margin:0cm 0cm 0pt"><span style="font-family:'Courier New';font-size:10pt">    {</span></p> <p class=MsoNormal style="margin:0cm 0cm 0pt"><span style="font-family:'Courier New';font-size:10pt">      <span style="color:blue">if</span> (value.IsNull || value == <span style="color:#a31515">&quot;&quot;</span>) <span style="color:blue">return</span>;</span></p> <p class=MsoNormal style="margin:0cm 0cm 0pt"><span style="font-family:'Courier New';font-size:10pt"> </span></p> <p class=MsoNormal style="margin:0cm 0cm 0pt"><span style="font-family:'Courier New';font-size:10pt">      <span style="color:blue">if</span> (_location == <span style="color:#a31515">&quot;Mixed&quot;</span>) <span style="color:blue">return</span>;</span></p> <p class=MsoNormal style="margin:0cm 0cm 0pt"><span style="font-family:'Courier New';font-size:10pt"> </span></p> <p class=MsoNormal style="margin:0cm 0cm 0pt"><span style="font-family:'Courier New';font-size:10pt">      <span style="color:blue">switch</span> (value.Value)</span></p> <p class=MsoNormal style="margin:0cm 0cm 0pt"><span style="font-family:'Courier New';font-size:10pt">      {</span></p> <p class=MsoNormal style="margin:0cm 0cm 0pt"><span style="font-family:'Courier New';font-size:10pt">        <span style="color:blue">case</span> <span style="color:#a31515">&quot;Russia&quot;</span>:</span></p> <p class=MsoNormal style="margin:0cm 0cm 0pt"><span style="font-family:'Courier New';font-size:10pt">        <span style="color:blue">case</span> <span style="color:#a31515">&quot;Japan&quot;</span>:</span></p> <p class=MsoNormal style="margin:0cm 0cm 0pt"><span style="font-family:'Courier New';font-size:10pt">          <span style="color:blue">if</span> (_location == <span style="color:#a31515">&quot;North&quot;</span> || _location == <span style="color:#a31515">&quot;Unknown&quot;</span>) </span></p> <p class=MsoNormal style="margin:0cm 0cm 0pt"><span style="font-family:'Courier New';font-size:10pt">            _location = <span style="color:#a31515">&quot;North&quot;</span>;</span></p> <p class=MsoNormal style="margin:0cm 0cm 0pt"><span style="font-family:'Courier New';font-size:10pt">          <span style="color:blue">else</span></span></p> <p class=MsoNormal style="margin:0cm 0cm 0pt"><span style="font-family:'Courier New';font-size:10pt">            _location = <span style="color:#a31515">&quot;Mixed&quot;</span>;</span></p> <p class=MsoNormal style="margin:0cm 0cm 0pt"><span style="font-family:'Courier New';font-size:10pt">          <span style="color:blue">break</span>;</span></p> <p class=MsoNormal style="margin:0cm 0cm 0pt"><span style="font-family:'Courier New';font-size:10pt">        <span style="color:blue">case</span> <span style="color:#a31515">&quot;Australia&quot;</span>:</span></p> <p class=MsoNormal style="margin:0cm 0cm 0pt"><span style="font-family:'Courier New';font-size:10pt">        <span style="color:blue">case</span> <span style="color:#a31515">&quot;New Zealand&quot;</span>:</span></p> <p class=MsoNormal style="margin:0cm 0cm 0pt"><span style="font-family:'Courier New';font-size:10pt">          <span style="color:blue">if</span> (_location == <span style="color:#a31515">&quot;South&quot;</span> || _location == <span style="color:#a31515">&quot;Unknown&quot;</span>)</span></p> <p class=MsoNormal style="margin:0cm 0cm 0pt"><span style="font-family:'Courier New';font-size:10pt">            _location = <span style="color:#a31515">&quot;South&quot;</span>;</span></p> <p class=MsoNormal style="margin:0cm 0cm 0pt"><span style="font-family:'Courier New';font-size:10pt">          <span style="color:blue">else</span></span></p> <p class=MsoNormal style="margin:0cm 0cm 0pt"><span style="font-family:'Courier New';font-size:10pt">            _location = <span style="color:#a31515">&quot;Mixed&quot;</span>;</span></p> <p class=MsoNormal style="margin:0cm 0cm 0pt"><span style="font-family:'Courier New';font-size:10pt"> </span></p> <p class=MsoNormal style="margin:0cm 0cm 0pt"><span style="font-family:'Courier New';font-size:10pt">          <span style="color:blue">break</span>;</span></p> <p class=MsoNormal style="margin:0cm 0cm 0pt"><span style="font-family:'Courier New';font-size:10pt">      }</span></p> <p class=MsoNormal style="margin:0cm 0cm 0pt"><span style="font-family:'Courier New';font-size:10pt">    }</span></p> <p class=MsoNormal style="margin:0cm 0cm 0pt"><span style="font-family:'Courier New';font-size:10pt"> </span></p> <p class=MsoNormal style="margin:0cm 0cm 0pt"><span style="font-family:'Courier New';font-size:10pt">    <span style="color:blue">public</span> <span style="color:blue">void</span> Merge(<span style="color:#2b91af">CountryLocation</span> group)</span></p> <p class=MsoNormal style="margin:0cm 0cm 0pt"><span style="font-family:'Courier New';font-size:10pt">    {</span></p> <p class=MsoNormal style="margin:0cm 0cm 0pt"><span style="font-family:'Courier New';font-size:10pt">      _location = group._location;</span></p> <p class=MsoNormal style="margin:0cm 0cm 0pt"><span style="font-family:'Courier New';font-size:10pt">    }</span></p> <p class=MsoNormal style="margin:0cm 0cm 0pt"><span style="font-family:'Courier New';font-size:10pt"> </span></p> <p class=MsoNormal style="margin:0cm 0cm 0pt"><span style="font-family:'Courier New';font-size:10pt">    <span style="color:blue">public</span> <span style="color:#2b91af">SqlString</span> Terminate()</span></p> <p class=MsoNormal style="margin:0cm 0cm 0pt"><span style="font-family:'Courier New';font-size:10pt">    {</span></p> <p class=MsoNormal style="margin:0cm 0cm 0pt"><span style="font-family:'Courier New';font-size:10pt">      <span style="color:blue">return</span> _location;</span></p> <p class=MsoNormal style="margin:0cm 0cm 0pt"><span style="font-family:'Courier New';font-size:10pt"> </span></p> <p class=MsoNormal style="margin:0cm 0cm 0pt"><span style="font-family:'Courier New';font-size:10pt">    }</span></p> <p class=MsoNormal style="margin:0cm 0cm 0pt"><span style="font-family:'Courier New';font-size:10pt"> </span></p> <p class=MsoNormal style="margin:0cm 0cm 0pt"><span style="font-family:'Courier New';font-size:10pt">    <span style="color:blue">public</span> <span style="color:blue">void</span> Read(<span style="color:#2b91af">BinaryReader</span> r)</span></p> <p class=MsoNormal style="margin:0cm 0cm 0pt"><span style="font-family:'Courier New';font-size:10pt">    {</span></p> <p class=MsoNormal style="margin:0cm 0cm 0pt"><span style="font-family:'Courier New';font-size:10pt">      _location = r.ReadString();</span></p> <p class=MsoNormal style="margin:0cm 0cm 0pt"><span style="font-family:'Courier New';font-size:10pt">    }</span></p> <p class=MsoNormal style="margin:0cm 0cm 0pt"><span style="font-family:'Courier New';font-size:10pt"> </span></p> <p class=MsoNormal style="margin:0cm 0cm 0pt"><span style="font-family:'Courier New';font-size:10pt">    <span style="color:blue">public</span> <span style="color:blue">void</span> Write(<span style="color:#2b91af">BinaryWriter</span> w)</span></p> <p class=MsoNormal style="margin:0cm 0cm 0pt"><span style="font-family:'Courier New';font-size:10pt">    {</span></p> <p class=MsoNormal style="margin:0cm 0cm 0pt"><span style="font-family:'Courier New';font-size:10pt">      w.Write(_location.ToString());</span></p> <p class=MsoNormal style="margin:0cm 0cm 0pt"><span style="font-family:'Courier New';font-size:10pt">    }</span></p> <p class=MsoNormal style="margin:0cm 0cm 0pt"><span style="font-family:'Courier New';font-size:10pt"> </span></p> <p class=MsoNormal style="margin:0cm 0cm 0pt"><span style="font-family:'Courier New';font-size:10pt">  }</span></p> <p class=MsoNormal style="margin:0cm 0cm 0pt"> </p>Thu, 12 Nov 2009 22:32:45 Z2009-11-20T09:47:11Zhttp://social.msdn.microsoft.com/Forums/en-US/sqlnetfx/thread/65d4aec0-ab03-45f9-b4b3-be24cb2b9ce4http://social.msdn.microsoft.com/Forums/en-US/sqlnetfx/thread/65d4aec0-ab03-45f9-b4b3-be24cb2b9ce4r.muralidharhttp://social.msdn.microsoft.com/Profile/en-US/?user=r.muralidharGlobal Scope for Database CLR Variables<p class=MsoNormal style="margin:0in 0in 0pt"><span style="font-size:10pt;font-family:'Century Gothic','sans-serif'">I would like to know if we can store variables (from CLR Functions) on global scope; something which is comparable to Application Scope in APS.Net which lets us access variables across processes and calls. I am planning to keep a dictionary object on the global scope. Need to know if this is possible.</span></p><hr class="sig">Regards- Muralidhar | If my response helped, please help me by marking my response as the answer and voting as appropriate...Fri, 13 Nov 2009 01:35:52 Z2009-11-20T09:48:46Zhttp://social.msdn.microsoft.com/Forums/en-US/sqlnetfx/thread/52200a29-d1fd-43f6-a744-68b636f1c0ffhttp://social.msdn.microsoft.com/Forums/en-US/sqlnetfx/thread/52200a29-d1fd-43f6-a744-68b636f1c0ffAndy7939http://social.msdn.microsoft.com/Profile/en-US/?user=Andy7939Extract a CLR Assembly bit stream into a .DLL fileI have taken over a SQL Server 2005 project that uses the SQL Assemblies to invoke a web service. Unfortunately the assembly needs amending but the original Visual Studio project is not available. Is there any way of extracting the CLR Assembly bit stream from sql server into a .dll file so that I can then view the dll using a tool like Reflector. <br/><br/>Andy.Tue, 10 Nov 2009 17:38:46 Z2009-11-19T09:36:42Zhttp://social.msdn.microsoft.com/Forums/en-US/sqlnetfx/thread/2ceb23f6-bc03-474c-93b9-49ffe88958bdhttp://social.msdn.microsoft.com/Forums/en-US/sqlnetfx/thread/2ceb23f6-bc03-474c-93b9-49ffe88958bdHans2GSOhttp://social.msdn.microsoft.com/Profile/en-US/?user=Hans2GSOCREATE AGGREGATE failed because type .. does not conform to UDAGG specification due to method 'Init'<p><font size=2>I am trying to get the CLR user-defined aggregate functions sample working (VB version). </font></p> <p><font size=2>I've saved the sample (from <font size=3><span id=nsrTitle><font size=1>Invoking CLR User-Defined Aggregate Functions</font></span> </font>) to a .vb file and compiled it like this:</font></p> <p><font size=2></font> </p> <p><font size=2>C:\data\VStudio\projects\SQLutils\SQLutils&gt;c:\WINDOWS\Microsoft.NET\Framework\v2<br>.0.50727\vbc  /t:library /out: SQLutils.dll Class1.vb<br>Microsoft (R) Visual Basic Compiler versie 8.0.50727.42<br>voor Microsoft (R) .NET Framework versie 2.0.50727.42<br>Copyright (c) Microsoft Corporation. Alle rechten voorbehouden.</font></p> <p><font size=2></font> </p> <p><font size=2>The SQLutils.dll file is created without warnings or errors.</font></p> <p><font size=2></font> </p> <p><font size=2>I've created the assembly</font></p> <p><font size=2></font> </p><font color="#0000ff"> <p><font size=2>create</font></font><font size=2> <font color="#0000ff">assembly</font> sqlutildll <font color="#0000ff">from</font> <font color="#ff0000">'D:\SQLdata\dll\SQLutils.dll'</font></font></p> <p><font color="#ff0000" size=2></font> </p> <p><font color="#000000" size=2>and then the function:</font></p> <p><font size=2><font color="#ff0000"> </p></font></font><font color="#0000ff"> <p><font size=2>CREATE</font></font><font size=2> <font color="#0000ff">AGGREGATE</font> Concat <font color="#808080">(</font>@input <font color="#0000ff">nvarchar</font><font color="#808080">(</font>200<font color="#808080">))</font> <font color="#0000ff">RETURNS</font> <font color="#0000ff">nvarchar</font><font color="#808080">(</font><font color="#ff00ff">max</font><font color="#808080">)</p></font></font><font color="#0000ff"> <p><font size=2>EXTERNAL</font></font><font size=2> <font color="#0000ff">NAME</font> sqlutildll<font color="#808080">.</font>Concatenate</font></p> <p><font size=2></font> </p> <p><font size=2>and then I got this error:</font></p> <p><font size=2></font> </p> <p><font size=2>Msg 6558, Level 16, State 1, Line 1</font></p> <p><font size=2>CREATE AGGREGATE failed because type 'Concatenate' does not conform to UDAGG specification due to method 'Init'.</font></p> <p><font size=2>Msg 6597, Level 16, State 2, Line 1</font></p> <p><font size=2>CREATE AGGREGATE failed.</font></p> <p><font size=2></font> </p> <p><font size=2>What is this UDAGG specification ?</font></p> <p><font size=2>How can I make this function working?</font></p> <p><font size=2></font> </p> <p><font size=2>The VB code:</font></p><font color="#0000ff" size=2> <p> <div class=codeseg> <div class=codecontent> <div class=codesniptitle><span style="width:100%">Code Snippet</span></div><font color="#0000ff" size=2> <p>Imports</font><font size=2> System</p></font><font color="#0000ff" size=2> <p>Imports</font><font size=2> System.Data</p></font><font color="#0000ff" size=2> <p>Imports</font><font size=2> Microsoft.SqlServer.Server</p></font><font color="#0000ff" size=2> <p>Imports</font><font size=2> System.Data.SqlTypes</p></font><font color="#0000ff" size=2> <p>Imports</font><font size=2> System.IO</p></font><font color="#0000ff" size=2> <p>Imports</font><font size=2> System.Text</p> <p>&lt;Serializable(), SqlUserDefinedAggregate(Format.UserDefined, IsInvariantToNulls:=</font><font color="#0000ff" size=2>True</font><font size=2>, IsInvariantToDuplicates:=</font><font color="#0000ff" size=2>False</font><font size=2>, IsInvariantToOrder:=</font><font color="#0000ff" size=2>False</font><font size=2>, MaxByteSize:=8000)&gt; &lt;Microsoft.VisualBasic.ComClass()&gt; _</p></font><font color="#0000ff" size=2> <p>Public</font><font size=2> </font><font color="#0000ff" size=2>Class</font><font size=2> Concatenate</p> <p></font><font color="#0000ff" size=2>Implements</font><font size=2> IBinarySerialize</p> <p></font><font color="#008000" size=2>''' </font><font color="#808080" size=2>&lt;summary&gt;</p></font><font size=2> <p></font><font color="#008000" size=2>''' The variable that holds the intermediate result of the concatenation</p></font><font size=2> <p></font><font color="#008000" size=2>''' </font><font color="#808080" size=2>&lt;/summary&gt;</p></font><font size=2> <p></font><font color="#0000ff" size=2>Private</font><font size=2> intermediateResult </font><font color="#0000ff" size=2>As</font><font size=2> StringBuilder</p> <p></font><font color="#008000" size=2>''' </font><font color="#808080" size=2>&lt;summary&gt;</p></font><font size=2> <p></font><font color="#008000" size=2>''' Initialize the internal data structures</p></font><font size=2> <p></font><font color="#008000" size=2>''' </font><font color="#808080" size=2>&lt;/summary&gt;</p></font><font size=2> <p></font><font color="#0000ff" size=2>Public</font><font size=2> </font><font color="#0000ff" size=2>Sub</font><font size=2> Init()</p> <p></font><font color="#0000ff" size=2>Me</font><font size=2>.intermediateResult = </font><font color="#0000ff" size=2>New</font><font size=2> StringBuilder()</p> <p></font><font color="#0000ff" size=2>End</font><font size=2> </font><font color="#0000ff" size=2>Sub</p></font><font size=2> <p></font><font color="#008000" size=2>''' </font><font color="#808080" size=2>&lt;summary&gt;</p></font><font size=2> <p></font><font color="#008000" size=2>''' Accumulate the next value, not if the value is null</p></font><font size=2> <p></font><font color="#008000" size=2>''' </font><font color="#808080" size=2>&lt;/summary&gt;</p></font><font size=2> <p></font><font color="#008000" size=2>''' </font><font color="#808080" size=2>&lt;param name=&quot;value&quot;&gt;&lt;/param&gt;</p></font><font size=2> <p></font><font color="#0000ff" size=2>Public</font><font size=2> </font><font color="#0000ff" size=2>Sub</font><font size=2> Accumulate(</font><font color="#0000ff" size=2>ByVal</font><font size=2> value </font><font color="#0000ff" size=2>As</font><font size=2> SqlString)</p> <p></font><font color="#0000ff" size=2>If</font><font size=2> value.IsNull </font><font color="#0000ff" size=2>Then</p></font><font size=2> <p></font><font color="#0000ff" size=2>Return</p></font><font size=2> <p></font><font color="#0000ff" size=2>End</font><font size=2> </font><font color="#0000ff" size=2>If</p></font><font size=2> <p></font><font color="#0000ff" size=2>Me</font><font size=2>.intermediateResult.Append(value.Value).Append(&quot;,&quot;c)</p> <p></font><font color="#0000ff" size=2>End</font><font size=2> </font><font color="#0000ff" size=2>Sub</p></font><font size=2> <p></font><font color="#008000" size=2>''' </font><font color="#808080" size=2>&lt;summary&gt;</p></font><font size=2> <p></font><font color="#008000" size=2>''' Merge the partially computed aggregate with this aggregate.</p></font><font size=2> <p></font><font color="#008000" size=2>''' </font><font color="#808080" size=2>&lt;/summary&gt;</p></font><font size=2> <p></font><font color="#008000" size=2>''' </font><font color="#808080" size=2>&lt;param name=&quot;other&quot;&gt;&lt;/param&gt;</p></font><font size=2> <p></font><font color="#0000ff" size=2>Public</font><font size=2> </font><font color="#0000ff" size=2>Sub</font><font size=2> Merge(</font><font color="#0000ff" size=2>ByVal</font><font size=2> other </font><font color="#0000ff" size=2>As</font><font size=2> Concatenate)</p> <p></font><font color="#0000ff" size=2>Me</font><font size=2>.intermediateResult.Append(other.intermediateResult)</p> <p></font><font color="#0000ff" size=2>End</font><font size=2> </font><font color="#0000ff" size=2>Sub</p></font><font size=2> <p></font><font color="#008000" size=2>''' </font><font color="#808080" size=2>&lt;summary&gt;</p></font><font size=2> <p></font><font color="#008000" size=2>''' Called at the end of aggregation, to return the results of the aggregation.</p></font><font size=2> <p></font><font color="#008000" size=2>''' </font><font color="#808080" size=2>&lt;/summary&gt;</p></font><font size=2> <p></font><font color="#008000" size=2>''' </font><font color="#808080" size=2>&lt;returns&gt;&lt;/returns&gt;</p></font><font size=2> <p></font><font color="#0000ff" size=2>Public</font><font size=2> </font><font color="#0000ff" size=2>Function</font><font size=2> Terminate() </font><font color="#0000ff" size=2>As</font><font size=2> SqlString</p> <p></font><font color="#0000ff" size=2>Dim</font><font size=2> output </font><font color="#0000ff" size=2>As</font><font size=2> </font><font color="#0000ff" size=2>String</font><font size=2> = </font><font color="#0000ff" size=2>String</font><font size=2>.Empty</p> <p></font><font color="#008000" size=2>'delete the trailing comma, if any</p></font><font size=2> <p></font><font color="#0000ff" size=2>If</font><font size=2> </font><font color="#0000ff" size=2>Not</font><font size=2> (</font><font color="#0000ff" size=2>Me</font><font size=2>.intermediateResult </font><font color="#0000ff" size=2>Is</font><font size=2> </font><font color="#0000ff" size=2>Nothing</font><font size=2>) </font><font color="#0000ff" size=2>AndAlso</font><font size=2> </font><font color="#0000ff" size=2>Me</font><font size=2>.intermediateResult.Length &gt; 0 </font><font color="#0000ff" size=2>Then</p></font><font size=2> <p>output = </font><font color="#0000ff" size=2>Me</font><font size=2>.intermediateResult.ToString(0, </font><font color="#0000ff" size=2>Me</font><font size=2>.intermediateResult.Length - 1)</p> <p></font><font color="#0000ff" size=2>End</font><font size=2> </font><font color="#0000ff" size=2>If</p></font><font size=2> <p></font><font color="#0000ff" size=2>Return</font><font size=2> </font><font color="#0000ff" size=2>New</font><font size=2> SqlString(output)</p> <p></font><font color="#0000ff" size=2>End</font><font size=2> </font><font color="#0000ff" size=2>Function</p></font><font size=2> <p></font><font color="#0000ff" size=2>Public</font><font size=2> </font><font color="#0000ff" size=2>Sub</font><font size=2> Read(</font><font color="#0000ff" size=2>ByVal</font><font size=2> r </font><font color="#0000ff" size=2>As</font><font size=2> BinaryReader) </font><font color="#0000ff" size=2>Implements</font><font size=2> IBinarySerialize.Read</p> <p>intermediateResult = </font><font color="#0000ff" size=2>New</font><font size=2> StringBuilder(r.ReadString())</p> <p></font><font color="#0000ff" size=2>End</font><font size=2> </font><font color="#0000ff" size=2>Sub</p></font><font size=2> <p></font><font color="#0000ff" size=2>Public</font><font size=2> </font><font color="#0000ff" size=2>Sub</font><font size=2> Write(</font><font color="#0000ff" size=2>ByVal</font><font size=2> w </font><font color="#0000ff" size=2>As</font><font size=2> BinaryWriter) </font><font color="#0000ff" size=2>Implements</font><font size=2> IBinarySerialize.Write</p> <p>w.Write(</font><font color="#0000ff" size=2>Me</font><font size=2>.intermediateResult.ToString())</p> <p></font><font color="#0000ff" size=2>End</font><font size=2> </font><font color="#0000ff" size=2>Sub</p> <p>End</font><font size=2> </font><font color="#0000ff" size=2>Class</font></p></div></div> <p> </p></font> <p></p> <p><font color="#0000ff" size=2></p> <p> </p> <p> </p></font> <p> </p>Tue, 03 Jul 2007 19:44:45 Z2009-11-13T10:48:45Zhttp://social.msdn.microsoft.com/Forums/en-US/sqlnetfx/thread/be969619-8aeb-4934-a03c-869b927d0baahttp://social.msdn.microsoft.com/Forums/en-US/sqlnetfx/thread/be969619-8aeb-4934-a03c-869b927d0baaDilip Kulkarnihttp://social.msdn.microsoft.com/Profile/en-US/?user=Dilip%20KulkarniWhile using SQL CLR - Error Occured :: There is no database connection selected, Use the project property pages to select one.Hello Friends,<br/> <br/>                I am trying to use SQL CLR External Name variable. While Building the SQL Server Project I am getting the following error,<br/>       &quot; <strong>There is no database connection selected. Use the project property pages to select one </strong> &quot;<br/> <br/> Thanks in Advance... <hr class=sig> <strong>Thanks &amp; Regards,<br/> <span style="color:red"> Dilip D. Kulkarni</span> <br/> [ <span style="color:green">Explore the Unexplored!!!</span> ]</strong> <br/> <br/>Mon, 09 Nov 2009 10:36:15 Z2009-11-16T10:05:41Zhttp://social.msdn.microsoft.com/Forums/en-US/sqlnetfx/thread/626bfbb6-ef13-4194-90e4-2c53e101d3eehttp://social.msdn.microsoft.com/Forums/en-US/sqlnetfx/thread/626bfbb6-ef13-4194-90e4-2c53e101d3eemjcasthttp://social.msdn.microsoft.com/Profile/en-US/?user=mjcastSQL Server CLR and Virtual Memory AlloationWe have a CLR Stored procedure that we use to send as a binary string a file to the database server for further processing after it writes it to the FileSystem using a StreamWriter. I am running into a problem on our box where we are sending in a 75mb file (as a binary string) and all of a sudden the server runs out of memory.<br/><br/>The server is a 64 bit 16 processor with 26gb or ram on SQL version 9.00.3186.<br/><br/>I run this query to check on the memory;<br/><span style="font-family:'Courier New';color:blue;font-size:10pt">select</span><span style="font-family:'Courier New';font-size:10pt"> single_pages_kb, multi_pages_kb,virtual_memory_reserved_kb, virtual_memory_committed_kb <span style="color:blue">from</span> <span style="color:green">sys.dm_os_memory_clerks</span> <span style="color:blue">where</span> <span style="color:blue">type</span> <span style="color:gray">=</span> <span style="color:red">'MEMORYCLERK_SQLCLR'<br/><br/></span></span>And I get the following results<br/><span style="font-family:Courier New;font-size:x-small">single_pages_kb    multi_pages_kb    virtual_memory_reserved_kb   virtual_memory_committed_kb<br/></span>1144                               39920                           23080896                                            16787548<br/><br/>So virtually the CLR is consuming 16gb of memory for the 75mb file ( I can trace that the memory grows to this point only when we do this file upload, there are no loops of data occurring here, nor is anything else occurring within the system in the CLR). At this point the server is unusable and we must reboot the sql instance.<br/><br/>We were having no problems as of a week ago and this started all of a sudden the other day and we are at a loss to explain what is going on here. I am not sure if there is some garbage collecting that is not happening or something else that is going on from a configuration standpoint of the CLR running on the server.<br/><br/>Thank you for any help that you can provide.<br/>Thu, 12 Nov 2009 16:15:31 Z2009-11-12T16:15:34Zhttp://social.msdn.microsoft.com/Forums/en-US/sqlnetfx/thread/1bc7672b-a7c8-4e42-90d4-91c46f3b60c9http://social.msdn.microsoft.com/Forums/en-US/sqlnetfx/thread/1bc7672b-a7c8-4e42-90d4-91c46f3b60c9davidwhttp://social.msdn.microsoft.com/Profile/en-US/?user=davidwHow to add CLR dll after restore db on another server? thanks<p align=left><font face=Arial size=2>I use VS2005 to deploy my CLR dll, it is easy. But after I copy db over to another server, the new server doesn't have driver W, so I need put dlls on Driver C. I think I have to relink assembly with those dlls. How should I do that, I tried Alter Assembly add file, but it doesn't work, the following is a script I get from one of my assembly. The dll is emaillib.dll, I could not find it in script. I have copied the dll to c:\emaillib.dll, so how can I link it back? I don;t want to drop the assembly since if I do that, I have to drop all CLR objects of the assembly first.</font></p> <p align=left> </p> <p align=left> </p> <p>CREATE ASSEMBLY [EmailLib]<br>AUTHORIZATION [dbo]<br>FROM 0x4D5A90000300000004000000FFFF0000B80000000000000040000000000000000000000......</p> <p align=left>WITH PERMISSION_SET = UNSAFE</p> <p>GO<br>ALTER ASSEMBLY [EmailLib]<br>ADD FILE FROM 0x4D6963726F736F667420432F432B2B204D534620372E30300D0A1A445300000000020000020000000F00000048000000000000000D000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000C0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF38C0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF.... bery long</p> <p align=left>AS N'EmailLib.pdb'</p> <p>GO<br>ALTER ASSEMBLY [EmailLib]<br>ADD FILE FROM 0xEFBBBF7573696E672053797374656D2E5265666C656374696F6E3B0D0A7573696E672053797374656D2E52756E74696D652E436F6D70696C657253657276696365733B0D0A7573696E672053797374656D2E52756E74696D652E496E7465726F7053657276696365733B0D0A7573696E672053797374656D2E446174612E53716C3B0D0A0D0A2F2F2047656E6572616C20496E666F726D6174696F6E2061626F757420616E20617373656D626C7920697320636F6E74726F6C6C6564207468726F7567682074686520666F6C6C6F77696E670D0A2F2F20736574206F6620617474726962757465732E204368616E6765207468657365206174747269627574652076616C75657320746F206D6F646966792074686520696E666F726D6174696F6E0D0A2F2F206173736F636961746564207769746820616E20617373656D626C792E0D0A5B617373656D626C793A20417373656D626C795469746C652822456D61696C4C696222295D0D0A5B617373656D626C793A20417373656D626C794465736372697074696F6E282222295D0D0A5B617373656D626C793A20417373656D626C79436F6E66696775726174696F6E282222295D0D0A5B617373656D626C793A20417373656D626C79436F6D70616E7928224D656D6C696E6B20496E632E22295D0D0A5B617373656D626C793A20417373656D626C7950726F647563742822456D61696C4C696222295D0D0A5B617373656D626C793A20417373656D626C79436F707972696768742822436F7079726967687420C2A9204D656D6C696E6B20496E632E203230303722295D0D0A5B617373656D626C793A20417373656D626C7954726164656D61726B282222295D0D0A5B617373656D626C793A20417373656D626C7943756C74757265282222295D0D0A0D0A5B617373656D626C793A20436F6D56697369626C652866616C7365295D0D0A0D0A2F2F0D0A2F2F2056657273696F6E20696E666F726D6174696F6E20666F7220616E20617373656D626C7920636F6E7369737473206F662074686520666F6C6C6F77696E6720666F75722076616C7565733A0D0A2F2F0D0A2F2F2020202020204D616A6F722056657273696F6E0D0A2F2F2020202020204D696E6F722056657273696F6E0D0A2F2F2020202020204275696C64204E756D6265720D0A2F2F2020202020205265766973696F6E0D0A2F2F0D0A2F2F20596F752063616E207370656369667920616C6C207468652076616C756573206F7220796F752063616E2064656661756C7420746865205265766973696F6E20616E64204275696C64204E756D626572730D0A2F2F206279207573696E672074686520272A272061732073686F776E2062656C6F773A0D0A5B617373656D626C793A20417373656D626C7956657273696F6E2822312E302E2A22295D0D0A0D0A<br>AS N'Properties\AssemblyInfo.cs'</p> <p>GO<br>EXEC sys.sp_addextendedproperty @name=N'AutoDeployed', @value=N'yes' , @level0type=N'ASSEMBLY',@level0name=N'EmailLib'<br>GO<br>EXEC sys.sp_addextendedproperty @name=N'SqlAssemblyProjectRoot', @value=N'W:\ablelink\ableclr\EmailLib' , @level0type=N'ASSEMBLY',@level0name=N'EmailLib'</p>Fri, 07 Sep 2007 06:21:29 Z2009-11-12T03:41:53Zhttp://social.msdn.microsoft.com/Forums/en-US/sqlnetfx/thread/8187df9f-75b8-4012-a21c-5a7ff9dcff1fhttp://social.msdn.microsoft.com/Forums/en-US/sqlnetfx/thread/8187df9f-75b8-4012-a21c-5a7ff9dcff1fkj1http://social.msdn.microsoft.com/Profile/en-US/?user=kj1Writing to SqlBytes datatype returned error "System.Data.SqlTypes.SqlTypeException: The buffer is insufficient"<span><span style="font-size:x-small">I am using MSSQL 2005 database and created CLR UDF . Writing to SqlBytes returned error<br/> System.Data.SqlTypes.SqlTypeException: The buffer is insufficient<br/> <br/> System.Data.SqlTypes.SqlTypeException: <br/>    at System.Data.SqlTypes.SqlBytes.Write(Int64 offset, <br/>                Byte[] buffer, Int32 offsetInBuffer, Int32 count)<br/> <br/> <br/> <br/> SqlBytes^ MyCLR::e_vrcl_nm(SqlChars pi_Data,<br/>                 SqlString Database,<br/>                 SqlString Owner,<br/>                 SqlString Table,<br/>                 SqlString vCol,<br/>                 SqlBinary vIV)<br/> {<br/> SqlBytes ^output = gcnew SqlBytes();<br/> .<br/> .<br/> while ((bytesRead = pi_Data.Read(offsetr,Data, 0, chunkSize)) &gt; 0)<br/> {<br/> .<br/> .<br/> .<br/> //converted to binary data and write to ouput<br/> output-&gt;Write(offsetw,tmpOutBuffer,0,tmpOutBytes); <br/> }<br/> <br/> .<br/> .<br/> .<br/> //return SqlBytes<br/> <br/> }<br/> <br/> How should I used SqlBytes write method to write large data ~1 GB in chunks and return back to sql <br/> </span> </span>Mon, 02 Nov 2009 10:31:50 Z2009-11-10T04:07:01Zhttp://social.msdn.microsoft.com/Forums/en-US/sqlnetfx/thread/8e934c30-8135-49d8-a087-7071abcb15b9http://social.msdn.microsoft.com/Forums/en-US/sqlnetfx/thread/8e934c30-8135-49d8-a087-7071abcb15b9AlanWh9999http://social.msdn.microsoft.com/Profile/en-US/?user=AlanWh9999SQLCLR Execution HangsI have a number of CLR Dlls in the database. Some of these are Safe and some are Unsafe. None of them use Reset Events. Occasionally I find that all the CLR execution against the database stops for anywhere up to a few minutes. Looking at the transactions against the database they are all in the CLR_MANUAL_RESET wait state. The CPU usage of sqlserver is neglibale at these times.<br/><br/>We are running SQL Server 2005 Enterprise Edition (64bit) 9.00.1399.06<br/><br/>Can anybody help my out with some pointers as to what to look for?<br/><br/>Is it worth upgrading to the latest service pack?<br/><br/>Thanks in advance<br/><br/>AlanWed, 21 Oct 2009 12:40:31 Z2009-11-03T13:22:31Zhttp://social.msdn.microsoft.com/Forums/en-US/sqlnetfx/thread/76cf9d5a-920b-4521-b01f-311651e6bf56http://social.msdn.microsoft.com/Forums/en-US/sqlnetfx/thread/76cf9d5a-920b-4521-b01f-311651e6bf56c0pehttp://social.msdn.microsoft.com/Profile/en-US/?user=c0pesql server 2008 express using a CLR stored procedure - email - couple questionsI just came across this:<br/> http://www.mssqltips.com/tip.asp?tip=1795<br/> <br/> which shows how to send email from sql server express using a CLR stored procedure. I'm using sql server 2008 express which does not support SQL Mail or Database Mail, so I'm just finding out.<br/> <br/> I'm ok with implementing the CLR stored procedure solution, as I have some .net development experience (a little, but enough). But I had a couple questions first..<br/> <br/> 1. is this a good option considering I'm using sql 2008 express?<br/> <br/> 2. what does the '<code style="font-size:12px"><span style="color:blue">WITH </span> <span style="color:black">PERMISSION_SET </span> <span style="color:blue">= </span> <span style="color:black">UNSAFE' line mean? Will I be degrading security by doing this?<br/> <br/> 3. in the example the smtp server address gets hardcoded into the .net assembly, can I modify that so that it gets the address from an external file? I have a few servers I need to do this with, and they would all be using a different smtp server. Basically, I'm not sure if accessing the .net code from sql would make that not possible? Or, duh, I just realized I could just add the smtp address as a parameter to the .net function and the stored procedure.<br/> <br/> any input would be appreciated.... by the way, is this the right group for this?<br/> </span> </code>Wed, 28 Oct 2009 18:47:53 Z2009-11-02T21:34:29Zhttp://social.msdn.microsoft.com/Forums/en-US/sqlnetfx/thread/bd0a1c17-6df7-47d8-81ac-3e4030be4262http://social.msdn.microsoft.com/Forums/en-US/sqlnetfx/thread/bd0a1c17-6df7-47d8-81ac-3e4030be4262Shyam SShttp://social.msdn.microsoft.com/Profile/en-US/?user=Shyam%20SS.Net Framework Error - System.ServiceModel<span style="font-size:xx-small"> <p>Hi,<br/><br/>          I have some some CLR methods which invokes WCF methods. I've deployed the required assemblies along with my SQL Project. The assembly got successfully deployed in SQL Server and the user defined functions got created. I'm able to invoke CLR methods which are not invoking WCF, but when WCF invoking UFS's are called. The below mentioned error is raised.<br/><br/><br/>A .NET Framework error occurred during execution of user-defined routine or aggregate &quot;SendRequest&quot;: System.IO.FileLoadException: Could not load file or assembly 'System.ServiceModel, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' or one of its dependencies. Assembly in host store has a different signature than assembly in GAC. (Exception from HRESULT: 0x80131050) See Microsoft Knowledge Base article 949080 for more information.</p> <p>System.IO.FileLoadException: at SQL.Utility.ServiceManager.SendRequest(String serviceAddress, Int64 deviceSerialNo, Int64 serialNo, Int64 requestId).<br/><br/><br/>Initially the configuration of the DB Server was <br/>1. Windows 2008 Server - 32 bit<br/>2. SQL Server 2008 - 32 bit<br/><br/>I was able to deploy and access all functions including UDF's invoking WCF's without any issue.<br/><br/>Now I've formatted the server and configured the same with<strong> 64</strong> bit. All the required 64 bit assemblies have been deployed to the Server. The SQL Project which I've created was not able to deploy with X64 build. So I've used &quot;Any CPU&quot; option and it sql project was deployed successfully. I'm able to access simple UDF's generated by my SQL Project, but the above mentioned error is raised on accessing UDF's invoking WCF methods.<br/><br/>I've checked the GAC and the assembly version, publickeytoken is the same for assembly in GAC and SQL.<br/><br/>Any pointers would be helpful.<br/><br/>Thanks in advance,<br/>Shyam SS</p> </span>Wed, 09 Sep 2009 10:33:35 Z2009-10-31T22:54:43Zhttp://social.msdn.microsoft.com/Forums/en-US/sqlnetfx/thread/090eea2f-495a-40bc-94fc-7b47a15005f9http://social.msdn.microsoft.com/Forums/en-US/sqlnetfx/thread/090eea2f-495a-40bc-94fc-7b47a15005f9bocheliehttp://social.msdn.microsoft.com/Profile/en-US/?user=bochelieSlow thread while counting lines i/o<span style="font-size:x-small;color:#0000ff"><span style="font-size:x-small;color:#0000ff"><span style="font-size:x-small;color:#0000ff"><span style="font-size:x-small;color:#0000ff"> <p class=MsoNormal style="margin:0cm 0cm 0pt"><span style="font-size:10pt;font-family:Verdana"><span style="color:#000000">Hallo,<br/>I have a problem with a thread that i made. I have a form which of course runs on his own thread. From that place i want to start a new thread which will count some lines in a tab separated file. The reason why i start a new thread is because i don’t want the counting of the lines to slow other processes on my form. Unfortunately this happens anyway.<br/><br/>I still can’t find out why the thread slows my other processes in the original form. The whole idea of a new thread is to avoid slowlines on other processes....<br/></span></span></p> <p class=MsoNormal style="margin:0cm 0cm 0pt"><span style="font-size:10pt;font-family:Verdana" lang=NL><span style="color:#000000">Does someone have any idea?</span></span><span style="font-size:10pt;font-family:Arial" lang=NL></span></p> <p><br/></p> <pre> Public Sub LogThreadStart() 'prepare/start new thread to log data 'this way the slowlines of datalogging don't interupt the other processes. Dim startThreadLogSub As New System.Threading.Thread(AddressOf Me.ThreadLogSub) startThreadLogSub.Priority = Threading.ThreadPriority.Normal startThreadLogSub.Start(Me.DsDTSettings.Tables(&quot;dtDataLogSettings&quot;).Rows(0).Item(&quot;clmnLogFileName&quot;).ToString()) End Sub Private Sub ThreadLogSub(ByVal Filnm As String) 'start LogFrmDLL.LogDataNow LogFrmDLL.LogDataNow(Me.QueueDataLog, Filnm, MaxLogFileLinesSurpassed) End Sub Public Module LogFrmDLL Public Sub LogDataNow(ByVal QueueLog As Queue, ByVal FileNameDataLog As String, ByRef MaxLogFileLinesSurpassed As Boolean) ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' ' if the logfile &gt;= then x lines then ' change MaxLogFileLinesSurpassed to true, in that way a new file ' is created when in HdForm.TimerDataLog_Tick Using FileReader2 As New Microsoft.VisualBasic.FileIO.TextFieldParser(FileNameDataLog) FileReader2.Delimiters = New String() {&quot; &quot;} While Not FileReader2.EndOfData FileReader2.ReadLine() If FileReader2.LineNumber &gt;= 70000 Then MaxLogFileLinesSurpassed = True End While End Using ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' End Sub End Module</pre> </span></span></span></span>Mon, 19 Oct 2009 09:22:28 Z2009-10-28T08:51:01Zhttp://social.msdn.microsoft.com/Forums/en-US/sqlnetfx/thread/942fe3d4-141a-486a-afdf-53f079d3a4d3http://social.msdn.microsoft.com/Forums/en-US/sqlnetfx/thread/942fe3d4-141a-486a-afdf-53f079d3a4d3mohit sharmahttp://social.msdn.microsoft.com/Profile/en-US/?user=mohit%20sharmaSQL Server 2005 | Queries Going Into Suspended ModeHi,<br><br>We moved to SQL server 2005 (SP1) recently and are observing a strange problem. During our performance tuning runs, some queries would never finish execution. Looking at the traces on the client side we don't get any hint of root cause. We see traces right upto the DB operation API (for instance C#'s ExecuteCommand) and no traces beyond that. The call never returns/errors out despite setting the command timeout to 30 sec. On the server side we see the SPIDs of these queries in suspended state with one of the below mentioned wait types (so far):<br>-resource_semaphore_query_compile<br>-ASYNC_NETWORK_IO<br>-Cxpacket<br><br>Server config:<br>Winserver 2003<br>4 dual core Xeon 3.2 Ghz<br>18 gigs of RAM<br>parallelism level set to 6<br><br>Has anyone experienced something similar on SQL server 2005 ?<br><br>Regards,Sat, 09 Dec 2006 14:00:33 Z2009-10-28T00:01:55Zhttp://social.msdn.microsoft.com/Forums/en-US/sqlnetfx/thread/02dd680b-8db3-442f-a6fb-29501443d90ehttp://social.msdn.microsoft.com/Forums/en-US/sqlnetfx/thread/02dd680b-8db3-442f-a6fb-29501443d90etorohmhttp://social.msdn.microsoft.com/Profile/en-US/?user=torohmCreate Assembly in SQL Sevrer 2008 without knowing exact pathHi.<br/><br/>I need help with how to create an assembly in a sql server 2008 database witout being able to issue the command &quot;CREATE ASSEMBLY FROM&quot; with a local or networked path.<br/><br/>I have a Database Setup project that references the .dll, I could also have it as a resource if that helps.  The Setup project is wpf and will run as an exe and will if needed run from a directory where the .dll in question resides.<br/> <br/>What I need is a way to create the assembly in the database without SQL Server knowing where the assembly is (at least from a local or UNC point of view), as install paths and computernames differ...obviously. It needs to be generic and work from all paths therefore I cannot hard code the path into the CREATE ASSEMBLY command. Of course I don't have to issue that command if I can use others, but thats what I know of now.<br/><br/>I will of course be able to establish a SqlConnection between my client and Sql server<br/><br/>Is this even possible?<br/><br/>I could elaborate a whole lot more to get you to understand my problem, but it would most likely be too much so I'll wait and see if anyone gets this.<br/><br/><br/>Best Regards/t<br/>Fri, 23 Oct 2009 14:59:53 Z2009-10-27T08:41:43Zhttp://social.msdn.microsoft.com/Forums/en-US/sqlnetfx/thread/abccfac9-af24-4116-90d6-8ab8205e5c62http://social.msdn.microsoft.com/Forums/en-US/sqlnetfx/thread/abccfac9-af24-4116-90d6-8ab8205e5c62ARRMhttp://social.msdn.microsoft.com/Profile/en-US/?user=ARRMIntegrating Website with accounting software<p>Hello Friends,<br/><br/>I have created an Ecommerce website using asp.net and sql server 2008; my question is I have to integrate my website with the OPERA II Accounting software;<br/>How do I do that?<br/>If I am integrating with OPERA II software do I have to write logic to calculate the price options and discounts as presently this is done with OPERA<br/>How do I introduce the banking system; for credit card payments <br/><br/>thanks</p>Mon, 26 Oct 2009 12:28:46 Z2009-11-03T09:58:15Zhttp://social.msdn.microsoft.com/Forums/en-US/sqlnetfx/thread/e251e0f9-f60d-4bcf-a213-be61aecaaad7http://social.msdn.microsoft.com/Forums/en-US/sqlnetfx/thread/e251e0f9-f60d-4bcf-a213-be61aecaaad7davidwhttp://social.msdn.microsoft.com/Profile/en-US/?user=davidwWhere can I find the dll file which was auto deployed to SQL 2005?I can see the SP it created, but I could not find the DLL, any idea?<br/>thanks!Fri, 23 Oct 2009 21:39:28 Z2009-11-02T09:34:35Zhttp://social.msdn.microsoft.com/Forums/en-US/sqlnetfx/thread/bd89ebcf-3e32-4f8c-ad97-3a9a5439221ahttp://social.msdn.microsoft.com/Forums/en-US/sqlnetfx/thread/bd89ebcf-3e32-4f8c-ad97-3a9a5439221akrishna_cbehttp://social.msdn.microsoft.com/Profile/en-US/?user=krishna_cbecalling webservice from sql server 2005 trigger Hi,<br/> <br/>         I am using &quot;HttpRuntime.Cache.Insert&quot; to maintain the data set in the cache. The problem is that when new data is added to the data base table, I need to update data set which is in the cache.<br/> <br/> For this I want to  call a webservice from the trigger to update the data set(cache). Can anyone help me that how to do that?<br/> <br/> Thanks in advance<br/><hr class="sig">krishnaTue, 20 Oct 2009 17:31:00 Z2009-10-29T12:38:35Zhttp://social.msdn.microsoft.com/Forums/en-US/sqlnetfx/thread/e8877bf9-8cde-42e3-ace1-dded04b90b56http://social.msdn.microsoft.com/Forums/en-US/sqlnetfx/thread/e8877bf9-8cde-42e3-ace1-dded04b90b56Vijay Nakkondahttp://social.msdn.microsoft.com/Profile/en-US/?user=Vijay%20Nakkondaunable to open the physical file operating system error 32Hi, <br/><br/>I have installed Sql Server 2005 with an instance name.<br/><br/>I am able to login using SQL Management Studio.<br/><br/>When i try to connect using Visual Studio through database explorer (its a VSTA for infopath), I get the error unable to open the physical file operating system error 32.  I am struggling to slove this.  <br/><br/>Any help in this regard would be helpful.<br/><br/>Thanks and Regards,<br/>Vijaybabu.N.S<br/><br/>Thu, 09 Jul 2009 15:00:36 Z2009-11-22T22:18:49Zhttp://social.msdn.microsoft.com/Forums/en-US/sqlnetfx/thread/47e87f26-fc66-491c-b09a-255068608074http://social.msdn.microsoft.com/Forums/en-US/sqlnetfx/thread/47e87f26-fc66-491c-b09a-255068608074Rudy68http://social.msdn.microsoft.com/Profile/en-US/?user=Rudy68running 64 bit sql server mgmt studioHello All!<br/> <br/> So I got a new computer with Vista Ultimate 64 bit.  I have SQL developer, 32 and 64 bit versions.  I loaded the 64 bit, but I can't get mgmt studio to load.  I tried both 64 and 32.  Any thoughts?<br/> <br/> TIA!<br/> <br/> RudyTue, 20 Oct 2009 02:00:28 Z2009-10-26T12:13:58Zhttp://social.msdn.microsoft.com/Forums/en-US/sqlnetfx/thread/ce6873da-3331-4be5-ae47-9e63f43cb2b7http://social.msdn.microsoft.com/Forums/en-US/sqlnetfx/thread/ce6873da-3331-4be5-ae47-9e63f43cb2b7MikeMooreUKhttp://social.msdn.microsoft.com/Profile/en-US/?user=MikeMooreUKThe UDP/UDF/UDT did not revert thread token.<p align=left><font face=Arial size=2>I have been struggling with this error for a while now. Not much when I put it in the search engines. I get the error as follows when I execute this CLR stored procedure:</font></p> <p align=left><font size=1></font> </p> <p>Msg 10312, Level 16, State 49, Procedure SpPICK00, Line 0</p> <p>.NET Framework execution was aborted. The UDP/UDF/UDT did not revert thread token.</p> <p align=left> </p> <p align=left>The code for the stored procedure is as follows. If anybody could offer any advice on what this error means I would appreciate it. I know through debugging that it's erroring out on the ImpContext = ClientID.Impersonate() line.</p> <p align=left> </p><font size=2> <p></font><font color="#0000ff" size=2>Dim</font><font size=2> DbCon </font><font color="#0000ff" size=2>As</font><font size=2> </font><font color="#0000ff" size=2>New</font><font size=2> SqlConnection(</font><font color="#800000" size=2>&quot;context connection=true&quot;</font><font size=2>)</p> <p></font><font color="#0000ff" size=2>Dim</font><font size=2> DbSql </font><font color="#0000ff" size=2>As</font><font size=2> </font><font color="#0000ff" size=2>New</font><font size=2> SqlCommand(</font><font color="#800000" size=2>&quot;SELECT TOP 1 * FROM TblTransactions&quot;</font><font size=2>, DbCon)</p> <p></font><font color="#0000ff" size=2>Dim</font><font size=2> TransactionID </font><font color="#0000ff" size=2>As</font><font size=2> Int64</p> <p>DbSql.Connection.Open()</p> <p></font><font color="#0000ff" size=2>Dim</font><font size=2> DbRs </font><font color="#0000ff" size=2>As</font><font size=2> SqlDataReader</p> <p>DbRs = DbSql.ExecuteReader</p> <p></font><font color="#0000ff" size=2>While</font><font size=2> DbRs.Read</p> <p>TransactionID = DbRs(</font><font color="#800000" size=2>&quot;TransactionID&quot;</font><font size=2>)</p> <p></font><font color="#0000ff" size=2>End</font><font size=2> </font><font color="#0000ff" size=2>While</p></font><font size=2> <p>DbRs.Close()</p> <p></font><font color="#0000ff" size=2>Dim</font><font size=2> MenuID </font><font color="#0000ff" size=2>As</font><font size=2> Int16</p> <p></font><font color="#0000ff" size=2>Dim</font><font size=2> MONumber </font><font color="#0000ff" size=2>As</font><font size=2> </font><font color="#0000ff" size=2>String</p></font><font size=2> <p></font><font color="#0000ff" size=2>Dim</font><font size=2> LineNumber </font><font color="#0000ff" size=2>As</font><font size=2> </font><font color="#0000ff" size=2>String</p></font><font size=2> <p></font><font color="#0000ff" size=2>Dim</font><font size=2> PTUse </font><font color="#0000ff" size=2>As</font><font size=2> </font><font color="#0000ff" size=2>String</p></font><font size=2> <p></font><font color="#0000ff" size=2>Dim</font><font size=2> SEQN </font><font color="#0000ff" size=2>As</font><font size=2> </font><font color="#0000ff" size=2>String</p></font><font size=2> <p></font><font color="#0000ff" size=2>Dim</font><font size=2> WorkCentre </font><font color="#0000ff" size=2>As</font><font size=2> </font><font color="#0000ff" size=2>String</p></font><font size=2> <p></font><font color="#0000ff" size=2>Dim</font><font size=2> Stock </font><font color="#0000ff" size=2>As</font><font size=2> </font><font color="#0000ff" size=2>String</p></font><font size=2> <p></font><font color="#0000ff" size=2>Dim</font><font size=2> Bin </font><font color="#0000ff" size=2>As</font><font size=2> </font><font color="#0000ff" size=2>String</p></font><font size=2> <p></font><font color="#0000ff" size=2>Dim</font><font size=2> Qty </font><font color="#0000ff" size=2>As</font><font size=2> </font><font color="#0000ff" size=2>Double</p> <p> </p></font><font size=2> <p>DbSql = </font><font color="#0000ff" size=2>New</font><font size=2> SqlCommand(</font><font color="#800000" size=2>&quot;SELECT * FROM VwPickList WHERE TransactionID = @TransactionID&quot;</font><font size=2>, DbCon)</p> <p>DbSql.Parameters.Add(</font><font color="#800000" size=2>&quot;@TransactionID&quot;</font><font size=2>, SqlDbType.BigInt).Value = TransactionID</p> <p>DbRs = DbSql.ExecuteReader</p> <p></font><font color="#0000ff" size=2>If</font><font size=2> DbRs.Read </font><font color="#0000ff" size=2>Then</p></font><font size=2> <p>MenuID = DbRs(</font><font color="#800000" size=2>&quot;MenuID&quot;</font><font size=2>)</p> <p>MONumber = DbRs(</font><font color="#800000" size=2>&quot;MONumber&quot;</font><font size=2>)</p> <p>LineNumber = DbRs(</font><font color="#800000" size=2>&quot;LineNumber&quot;</font><font size=2>)</p> <p>PTUse = DbRs(</font><font color="#800000" size=2>&quot;PT_USE&quot;</font><font size=2>)</p> <p>SEQN = DbRs(</font><font color="#800000" size=2>&quot;SEQN&quot;</font><font size=2>)</p> <p>WorkCentre = DbRs(</font><font color="#800000" size=2>&quot;WorkCentre&quot;</font><font size=2>)</p> <p>Stock = DbRs(</font><font color="#800000" size=2>&quot;Stock&quot;</font><font size=2>)</p> <p>Bin = DbRs(</font><font color="#800000" size=2>&quot;Bin&quot;</font><font size=2>)</p> <p>Qty = DbRs(</font><font color="#800000" size=2>&quot;Hours&quot;</font><font size=2>)</p> <p></font><font color="#0000ff" size=2>End</font><font size=2> </font><font color="#0000ff" size=2>If</p></font><font size=2> <p>DbRs.Close()</p> <p>DbSql.Connection.Close()</p> <p>DbCon.Dispose()</p> <p>DbSql.Dispose()</p> <p></font><font color="#0000ff" size=2>Dim</font><font size=2> FSClient </font><font color="#0000ff" size=2>As</font><font size=2> </font><font color="#0000ff" size=2>New</font><font size=2> FSTIClient</p> <p></font><font color="#0000ff" size=2>Dim</font><font size=2> ClientID </font><font color="#0000ff" size=2>As</font><font size=2> WindowsIdentity</p> <p></font><font color="#0000ff" size=2>Dim</font><font size=2> ImpContext </font><font color="#0000ff" size=2>As</font><font size=2> WindowsImpersonationContext</p> <p>ClientID = SqlContext.WindowsIdentity</p> <p>ImpContext = ClientID.Impersonate</p> <p>Shell(</font><font color="#800000" size=2>&quot;NET USE K: \\FPTEST\FShift&quot;</font><font size=2>, AppWinStyle.Hide)</p> <p>FSClient.InitializeByConfigFile(</font><font color="#800000" size=2>&quot;K:\Mfgsys\fs.cfg&quot;</font><font size=2>, </font><font color="#0000ff" size=2>False</font><font size=2>, </font><font color="#0000ff" size=2>False</font><font size=2>)</p> <p></font><font color="#0000ff" size=2>If</font><font size=2> FSClient.IsLogonRequired </font><font color="#0000ff" size=2>Then</p></font><font size=2> <p>FSClient.Logon(</font><font color="#800000" size=2>&quot;VBS&quot;</font><font size=2>, </font><font color="#800000" size=2>&quot;visib&quot;</font><font size=2>, </font><font color="#800000" size=2>&quot;&quot;</font><font size=2>)</p> <p></font><font color="#0000ff" size=2>End</font><font size=2> </font><font color="#0000ff" size=2>If</p></font><font size=2> <p></font><font color="#0000ff" size=2>If</font><font size=2> MenuID = 2 </font><font color="#0000ff" size=2>Then</p></font><font size=2> <p></font><font color="#0000ff" size=2>Dim</font><font size=2> Pck </font><font color="#0000ff" size=2>As</font><font size=2> </font><font color="#0000ff" size=2>New</font><font size=2> PICK08</p> <p>Pck.OrderType.Value = </font><font color="#800000" size=2>&quot;M&quot;</p></font><font size=2> <p>Pck.IssueType.Value = </font><font color="#800000" size=2>&quot;I&quot;</p></font><font size=2> <p>Pck.OrderNumber.Value = MONumber</p> <p>Pck.LineNumber.Value = LineNumber</p> <p>Pck.PointOfUseID.Value = PTUse</p> <p>Pck.OperationSequenceNumber.Value = SEQN</p> <p>Pck.ItemNumber.Value = WorkCentre</p> <p>Pck.Stockroom.Value = Stock</p> <p>Pck.Bin.Value = Bin</p> <p>Pck.IssuedQuantity.Value = Qty</p> <p>FSClient.ProcessId(Pck)</p> <p></font><font color="#0000ff" size=2>ElseIf</font><font size=2> MenuID = 1 </font><font color="#0000ff" size=2>Then</p></font><font size=2> <p></font><font color="#0000ff" size=2>Dim</font><font size=2> Pck </font><font color="#0000ff" size=2>As</font><font size=2> </font><font color="#0000ff" size=2>New</font><font size=2> PICK04</p> <p>Pck.OrderType.Value = </font><font color="#800000" size=2>&quot;M&quot;</p></font><font size=2> <p>Pck.IssueType.Value = </font><font color="#800000" size=2>&quot;I&quot;</p></font><font size=2> <p>Pck.OrderNumber.Value = MONumber</p> <p>Pck.LineNumber.Value = LineNumber</p> <p>Pck.PointOfUseID.Value = PTUse</p> <p>Pck.OperationSequenceNumber.Value = SEQN</p> <p>Pck.ItemNumber.Value = WorkCentre</p> <p>Pck.IssuedQuantity.Value = Qty</p> <p>FSClient.ProcessId(Pck)</p> <p></font><font color="#0000ff" size=2>End</font><font size=2> </font><font color="#0000ff" size=2>If</p></font><font size=2> <p>FSClient.Terminate()</p> <p>ImpContext.Undo()</font><font color="#0000ff" size=2></p></font><font size=1> <p> </p> <p align=left></font> </p>Thu, 24 Jan 2008 10:29:47 Z2009-10-22T22:18:19Zhttp://social.msdn.microsoft.com/Forums/en-US/sqlnetfx/thread/285776bb-91d6-481d-92b6-60b77521e6b0http://social.msdn.microsoft.com/Forums/en-US/sqlnetfx/thread/285776bb-91d6-481d-92b6-60b77521e6b0Mark Gialohttp://social.msdn.microsoft.com/Profile/en-US/?user=Mark%20GialoSql Server Express Multiple Connection<p>Hi All,<br/><br/>I have a C# application that runs on Sql Server. The application has multiple SQLConnections to the same database. When I try to run the application on Sql Express 2005, it does not allow more than 1 SQLConnection.</p> <p>Is there anything I can do to fix this?</p> <p>Any insight is most appreciated.</p> <p>Mark G</p>Tue, 20 Oct 2009 17:51:44 Z2009-10-29T12:38:27Zhttp://social.msdn.microsoft.com/Forums/en-US/sqlnetfx/thread/559d459a-76b3-4ef4-a6f4-0fb9a83431b0http://social.msdn.microsoft.com/Forums/en-US/sqlnetfx/thread/559d459a-76b3-4ef4-a6f4-0fb9a83431b0new usershttp://social.msdn.microsoft.com/Profile/en-US/?user=new%20usersconvert smalldatatime to datatime <span><span> <pre class=libCScode style="white-space:pre-wrap">I try to query a calendar database which created by a third-party. The<br/> value stored in the event start datetime is a 18-digits number, for<br/> example: 633979008000000000, which is actually 2010/1/1/, 12:00AM, I<br/> try to understand how does this long integer/char calculate and how<br/> does the number/char related to a regular datetime, any function in<br/> SQL can do this conversion? Basically, I want to get the actually<br/> date and time from this number.<br/> <br/> <br/> <br/> Thank you.</pre> </span> </span>Wed, 21 Oct 2009 20:46:14 Z2009-10-29T12:41:41Zhttp://social.msdn.microsoft.com/Forums/en-US/sqlnetfx/thread/a4387ca3-9b45-4a91-a26a-4031d994cb05http://social.msdn.microsoft.com/Forums/en-US/sqlnetfx/thread/a4387ca3-9b45-4a91-a26a-4031d994cb05marcyhttp://social.msdn.microsoft.com/Profile/en-US/?user=marcyCLR Stored Procedures as system objectsHi there, <div>Is is possible (and how) to invoke CLR Stored procedures living in master from other databases, such that the sproc is executed from with in that database's context?</div> <div>This is simple in TSQL procs, marking the proc name as 'sp_' and executing the 'sys.sp_MS_marksystemobject'.&nbsp;</div> <div>This process seems to fail when I deploy my CLR proc.&nbsp;</div> <div><br /></div> <div>Any insight?</div>Tue, 13 Oct 2009 16:06:50 Z2009-10-22T15:29:28Zhttp://social.msdn.microsoft.com/Forums/en-US/sqlnetfx/thread/a9015ea4-955f-4ffc-9913-80b7c4fd90fbhttp://social.msdn.microsoft.com/Forums/en-US/sqlnetfx/thread/a9015ea4-955f-4ffc-9913-80b7c4fd90fbMaf Fereydounihttp://social.msdn.microsoft.com/Profile/en-US/?user=Maf%20FereydouniHow can i assign 5 digit Identity Increment in Microsoft Sql Server? HELP PLZZ.<span style="font-family:'Segoe UI', 'Lucida Grande', Verdana, Arial, Helvetica, sans-serif;font-size:13px;color:#333333;line-height:16px">Hi i have created a database, now i have a table that contain the primary key on my bill number column with tinyint and in column properties i have changed the identity specification to yes and its identity increment and seeds are 1 now what i need is i want my starting value increment begins with 5 digits number, for instance instead of when its just arranged by 1 2 3 4 5 and etc i want its increment to be like 00001 00002 00003 00004 so on and so forth and when it reaches 00009 it must automatically change the next increment to 00010  for each of my row. but unfortunately i couldnt do it with any possible datatype for my column, can anybody concern about this? <div style="font-weight:inherit;font-style:inherit;font-family:inherit;padding:0px;margin:0px;border:0px initial initial"><br/></div> <div style="font-weight:inherit;font-style:inherit;font-family:inherit;padding:0px;margin:0px;border:0px initial initial">thanks.</div> </span>Tue, 20 Oct 2009 17:09:58 Z2009-10-27T09:51:29Zhttp://social.msdn.microsoft.com/Forums/en-US/sqlnetfx/thread/72dfd39b-a765-40fc-82d5-ac58c316cf86http://social.msdn.microsoft.com/Forums/en-US/sqlnetfx/thread/72dfd39b-a765-40fc-82d5-ac58c316cf86Reg_Hhttp://social.msdn.microsoft.com/Profile/en-US/?user=Reg_HHandle "Query was cancelled by user." in CLR StoredProcHi everyone<br /> <br /> How can one elegantly handle the situation where the user cancels the CLR procedure (Alt+Break or job cancellation etc)?<br /> <br /> There doesn't appear to be any event or way to handle it. I've spent the past few hours trying to find a way to determine if the procedure had been cancelled by the user.&nbsp; What seems to be happening is that the CLR runtime for the procedure seems to get cleaned up immediately from when it is cancelled - it's like the runtime for the procedure has already been disposed. If I set a breakpoint and cancel the SP then I find my code context is immediately invalid.<br /> <br /> I was hoping to use a global Mutex but I whilst I can create a global mutex if the proc gets cancelled then the mutex still remains because it hasn't been released, due to the abrupt termination of the CLR procedure.<br /> <br /> This may be by-design, but is there any way this can be handled?<br /> <br /> Thanks<br /> <script>if (typeof(lpcurruser) == 'undefined') lpcurruser = ''; if (document.getElementById('lpcurruserelt') &amp;&amp; document.getElementById('lpcurruserelt').value != '') { lpcurruser = document.getElementById('lpcurruserelt').value; document.getElementById('lpcurruserelt').value = ''; } if (typeof(lpcurrpass) == 'undefined') lpcurrpass=''; if (document.getElementById('lpcurrpasselt') &amp;&amp; document.getElementById('lpcurrpasselt').value != '') { lpcurrpass = document.getElementById('lpcurrpasselt').value; document.getElementById('lpcurrpasselt').value = ''; } var lploc=1;var lponlyfill=null;if (typeof(onForgetMe) == 'function') { try { onForgetMe(0); } catch (lp_e) { } }lpcurruser = ''; lpcurrpass = '';</script> <script>if (typeof(lpcurruser) == 'undefined') lpcurruser = ''; if (document.getElementById('lpcurruserelt') &amp;&amp; document.getElementById('lpcurruserelt').value != '') { lpcurruser = document.getElementById('lpcurruserelt').value; document.getElementById('lpcurruserelt').value = ''; } if (typeof(lpcurrpass) == 'undefined') lpcurrpass=''; if (document.getElementById('lpcurrpasselt') &amp;&amp; document.getElementById('lpcurrpasselt').value != '') { lpcurrpass = document.getElementById('lpcurrpasselt').value; document.getElementById('lpcurrpasselt').value = ''; } var lploc=1;var lponlyfill=null;if (typeof(onForgetMe) == 'function') { try { onForgetMe(0); } catch (lp_e) { } }lpcurruser = ''; lpcurrpass = '';</script> <script>if (typeof(lpcurruser) == 'undefined') lpcurruser = ''; if (document.getElementById('lpcurruserelt') &amp;&amp; document.getElementById('lpcurruserelt').value != '') { lpcurruser = document.getElementById('lpcurruserelt').value; document.getElementById('lpcurruserelt').value = ''; } if (typeof(lpcurrpass) == 'undefined') lpcurrpass=''; if (document.getElementById('lpcurrpasselt') &amp;&amp; document.getElementById('lpcurrpasselt').value != '') { lpcurrpass = document.getElementById('lpcurrpasselt').value; document.getElementById('lpcurrpasselt').value = ''; } var lploc=1;var lponlyfill=null;if (typeof(onForgetMe) == 'function') { try { onForgetMe(0); } catch (lp_e) { } }lpcurruser = ''; lpcurrpass = '';</script> <script>if (typeof(lpcurruser) == 'undefined') lpcurruser = ''; if (document.getElementById('lpcurruserelt') &amp;&amp; document.getElementById('lpcurruserelt').value != '') { lpcurruser = document.getElementById('lpcurruserelt').value; document.getElementById('lpcurruserelt').value = ''; } if (typeof(lpcurrpass) == 'undefined') lpcurrpass=''; if (document.getElementById('lpcurrpasselt') &amp;&amp; document.getElementById('lpcurrpasselt').value != '') { lpcurrpass = document.getElementById('lpcurrpasselt').value; document.getElementById('lpcurrpasselt').value = ''; } var lploc=1;var lponlyfill=null;if (typeof(onForgetMe) == 'function') { try { onForgetMe(0); } catch (lp_e) { } }lpcurruser = ''; lpcurrpass = '';</script>Tue, 13 Oct 2009 12:25:20 Z2009-10-19T14:47:23Z