CLR Programming: Best Place To Define Utilities Functions

Apr 27, 2007

Hallo,

I find the CLR integration very handy and I would like to use it in the proper way but I need some helps because is not easy to find "best practice" programming info.

This is what I have to do: from a "period" coming from the DB I have to compute start/End date and save them in the DB.

The computation involves regular expression and several functions that makes several calculations on date type variable.

I have created my UserDefinedFunction class that contains the TV function to return a row with 2 fields (startdate,enddate).
Now my question is: what is the base place to define my utilities functions that perform the computation?
In the same class or it is better to add a new class?

For example I have created a module that contains all the Regular expressions patterns.

Any help is appreciated!

Thankx

Marina B.



View 1 Replies


ADVERTISEMENT

Is There A Place Where I Can Find The Events That Takes Place In Sql Server?

Jul 20, 2007

Is there a place where i can find events that takes place in the sql server? Like adding data to a database or something like that....



Regards

Karen

View 4 Replies View Related

16 Bit-client Utilities

Mar 30, 2000

Hi all,

I am going to upgrade a SQL server 6.5 box to SQL7.0. The 16 bit-client utilities are a prerequisite because there is a 16-bit application and requires some of the database libraries. My question is how does SQL7.0 deal with 16-bit application? In my case, could I upgrade the SQL6.5 box to SQL7.0?

I appreciate any input and help ahead,

Stella Liu

View 1 Replies View Related

Palm Utilities For DBA

Feb 23, 2001

Does anyone have any palm utilities, or reference docs, urls - I am administering SQL7 and would like info on Palm-3, using as a references. I have ModileDB installed, with Oracle Recovery references, but could not find SQL.

thanks,
Jason

View 3 Replies View Related

MS SQL Utilities For Documentation

Oct 16, 1998

I am looking for good utilities that document MS SQL table schema, indexes, layouts etc. I am currently looking at SQL auditor, but this product does not give me table schema or any kind of device revisions. I recently was given several SQL servers that have not been documented in any way.

thanks

ps SQL auditor gets a B+ in my book. Let me know what you think

View 2 Replies View Related

Sql Server Utilities

Apr 16, 2002

HI

Would like to know whether SQL server has the utilities do the following and the command to activiate the followings:
- limit the no. of login (ie to set the number of failed_login_attempts)
- password_reuse_max (eg password A can only be reuse 3 times)

tia
MK

View 1 Replies View Related

Client Utilities For MSDE

Mar 23, 2005

Hi,

I heard from a guy that the client utilities (Enterprice Manager and Query Analyser) that are on the Sql Server 2000 CD can be fetched separatly from Microsoft and that they can be deployed with MSDE to a potential customer.

Is that correct?

And if it is, where can I obtain those client apps?

TIA

Ohlywohly

View 2 Replies View Related

SQL Server Network Utilities

Jan 13, 2006

Hi everyone,
Can anyone tell me the basic difference between Client Network Utility and Server Network Utility and also when to use what..?????

View 1 Replies View Related

Removing SQL Utilities Off Server

Aug 27, 1998

Does anyone know how to remove SQL utilities off the server manually.
When I run the setup.exe from the SQL CD to remove SQL from server that option button is
shaded, I try reinstalling SQL utilities and then I try removing and still it won`t let me?
Help!!!

View 2 Replies View Related

DTS Version Control Utilities?

Jun 15, 2001

We are looking for utilities to help us manage DTS packages. Specifically to help us track changes in the packages in a fairly fine-grained fashion; several layers deeper than the version listing under package info, for example. Think of it as an object-oriented diff utility if you will, something that can report on changes in a package very specifically; for example, we need to know that step 4 of a package is a SQL widget and the text has changed between versions, and what the changes are. Converting the package to a VB project & versioning the source text doesn't work, for several reasons too complicated to state here.

Is there aything like this available? We would rather buy than build, but I haven't seen anything like this yet. If anyone has experience with such a utility I would appreciate knowing about this. Thanks.

Jim Rivera
Software Engineer
Grange Insurance Graoup
Seattle, WA

View 1 Replies View Related

Third Party Reindexing Utilities

Jul 23, 2005

Folks,I work on a system which is growing rapidly, with the number oftransactions we process growing on a daily basis. While this is goodnews or the business, maintenance is starting to become an issue as thedatabase is the backend for a website which cannot be down for alengthy period of time.While I do defrag the indexes, periodically the indexes do need to berebuilt. When this happens, the process locks pages and transactionsstart getting bounced out.Are their any third party utilities which will rebuild an indexwithout this locking occuring? Any help in pointing me in the rightdirection would be appreciated.

View 1 Replies View Related

Loadbalancing Utilities - For Clustered SQL 2000

Feb 20, 2001

Hi all ,

I would like to know about third party tools available or sites where I can get some evaluations on this tools to load balance our Clustered SQL 2000 on Windows 2000. Thanks for the help In Advance.

Shaji

View 2 Replies View Related

Installing SQL 6.5 And 2000 Client Utilities On The Same Machine

Aug 24, 2004

Can I install the client utilities for Microsoft SQL versions 6.5 and 2000 in the same machine?

Please, provide me with any information or links in this matter.

View 5 Replies View Related

Utilities To Check For Errors In Stored Procedures

Jul 20, 2005

I have written a utility that checks our stored procedures forpotentially incorrect code (eg = null as opposed to is null, unusedvariables/parameters etc). It also ensures that parameters/variablesetc match our naming conventions and data types/sizes are the sames asthe corresponding type in the database (if appropriate)Are there any other utilities that do this sort of thing?

View 1 Replies View Related

Utilities For Comparing Stored Procedure Results?

Dec 11, 2007

I have large stored procedures in SQL Server 2005 that often get updated. Sometimes it is very difficult to recognize how one change could impact the overall results. I would like to have some sample input that I could test during changes and see it compare the data results before & after my changes. This would help me quickly identify if the results are fine to pass through.

So basically I would like an easy way to compare the results of 2 stored procedures. Any suggestions or utilites that would help me do this?

View 3 Replies View Related

Compare Utilities For Comparing Stored Procedure Results?

Dec 10, 2007

I have large stored procedures in SQL Server 2005 that often get updated. Sometimes it is very difficult to recognize how one change could impact the overall results. I would like to have some sample input that I could test during changes and see it compare the data results before & after my changes. This would help me quickly identify if the results are fine to pass through.

So basically I would like an easy way to compare the results of 2 stored procedures. Any suggestions or utilites that would help me do this?

View 6 Replies View Related

SQL Server 2005: CLR Functions Vs SQL Functions

May 26, 2006

I was playing around with the new SQL 2005 CLR functionality andremembered this discussion that I had with Erland Sommarskog concerningperformance of scalar UDFs some time ago (See "Calling sp_oa* infunction" in this newsgroup). In that discussion, Erland made thefollowing comment about UDFs in SQL 2005:[color=blue][color=green]>>The good news is that in SQL 2005, Microsoft has addressed several of[/color][/color]these issues, and the cost of a UDF is not as severe there. In fact fora complex expression, a UDF in written a CLR language may be fasterthanthe corresponding expression using built-in T-SQL functions.<<I thought the I would put this to the test using some of the same SQLas before, but adding a simple scalar CLR UDF into the mix. The testinvolved querying a simple table with about 300,000 rows. Thescenarios are as follows:(A) Use a simple CASE function to calculate a column(B) Use a simple CASE function to calculate a column and as a criterionin the WHERE clause(C) Use a scalar UDF to calculate a column(D) Use a scalar UDF to calculate a column and as a criterion in theWHERE clause(E) Use a scalar CLR UDF to calculate a column(F) Use a scalar CLR UDF to calculate a column and as a criterion inthe WHERE clauseA sample of the results is as follows (time in milliseconds):(295310 row(s) affected)A: 1563(150003 row(s) affected)B: 906(295310 row(s) affected)C: 2703(150003 row(s) affected)D: 2533(295310 row(s) affected)E: 2060(150003 row(s) affected)F: 2190The scalar CLR UDF function was significantly faster than the classicscalar UDF, even for this very simple function. Perhaps a more complexfunction would have shown even a greater difference. Based on this, Imust conclude that Erland was right. Of course, it's still faster tostick with basic built-in functions like CASE.In another test, I decided to run some queries to compare built-inaggregates vs. a couple of simple CLR aggregates as follows:(G) Calculate averages by group using the built-in AVG aggregate(H) Calculate averages by group using a CLR aggregate that similatesthe built-in AVG aggregate(I) Calculate a "trimmed" average by group (average excluding highestand lowest values) using built-in aggregates(J) Calculate a "trimmed" average by group using a CLR aggregatespecially designed for this purposeA sample of the results is as follows (time in milliseconds):(59 row(s) affected)G: 313(59 row(s) affected)H: 890(59 row(s) affected)I: 216(59 row(s) affected)J: 846It seems that the CLR aggregates came with a significant performancepenalty over the built-in aggregates. Perhaps they would pay off if Iwere attempting a very complex type of aggregation. However, at thispoint I'm going to shy away from using these unless I can't find a wayto do the calculation with standard SQL.In a way, I'm happy that basic SQL still seems to be the fastest way toget things done. With the addition of the new CLR functionality, Isuspect that MS may be giving us developers enough rope to comfortablyhang ourselves if we're not careful.Bill E.Hollywood, FL------------------------------------------------------------------------- table TestAssignment, about 300,000 rowsCREATE TABLE [dbo].[TestAssignment]([TestAssignmentID] [int] NOT NULL,[ProductID] [int] NULL,[PercentPassed] [int] NULL,CONSTRAINT [PK_TestAssignment] PRIMARY KEY CLUSTERED([TestAssignmentID] ASC)--Scalar UDF in SQLCREATE FUNCTION [dbo].[fnIsEven](@intValue int)RETURNS bitASBEGINDeclare @bitReturnValue bitIf @intValue % 2 = 0Set @bitReturnValue=1ElseSet @bitReturnValue=0RETURN @bitReturnValueEND--Scalar CLR UDF/*using System;using System.Data;using System.Data.SqlClient;using System.Data.SqlTypes;using Microsoft.SqlServer.Server;public partial class UserDefinedFunctions{[Microsoft.SqlServer.Server.SqlFunction(IsDetermini stic=true,IsPrecise=true)]public static SqlBoolean IsEven(SqlInt32 value){if(value % 2 == 0){return true;}else{return false;}}};*/--Test #1--Scenario A - Query with calculated column--SELECT TestAssignmentID,CASE WHEN TestAssignmentID % 2=0 THEN 1 ELSE 0 END ASCalcColumnFROM TestAssignment--Scenario B - Query with calculated column as criterion--SELECT TestAssignmentID,CASE WHEN TestAssignmentID % 2=0 THEN 1 ELSE 0 END ASCalcColumnFROM TestAssignmentWHERE CASE WHEN TestAssignmentID % 2=0 THEN 1 ELSE 0 END=1--Scenario C - Query using scalar UDF--SELECT TestAssignmentID,dbo.fnIsEven(TestAssignmentID) AS CalcColumnFROM TestAssignment--Scenario D - Query using scalar UDF as crierion--SELECT TestAssignmentID,dbo.fnIsEven(TestAssignmentID) AS CalcColumnFROM TestAssignmentWHERE dbo.fnIsEven(TestAssignmentID)=1--Scenario E - Query using CLR scalar UDF--SELECT TestAssignmentID,dbo.fnIsEven_CLR(TestAssignmentID) AS CalcColumnFROM TestAssignment--Scenario F - Query using CLR scalar UDF as crierion--SELECT TestAssignmentID,dbo.fnIsEven_CLR(TestAssignmentID) AS CalcColumnFROM TestAssignmentWHERE dbo.fnIsEven(TestAssignmentID)=1--CLR Aggregate functions/*using System;using System.Data;using System.Data.SqlClient;using System.Data.SqlTypes;using Microsoft.SqlServer.Server;[Serializable][Microsoft.SqlServer.Server.SqlUserDefinedAggregate (Format.Native)]public struct Avg{public void Init(){this.numValues = 0;this.totalValue = 0;}public void Accumulate(SqlDouble Value){if (!Value.IsNull){this.numValues++;this.totalValue += Value;}}public void Merge(Avg Group){if (Group.numValues > 0){this.numValues += Group.numValues;this.totalValue += Group.totalValue;}}public SqlDouble Terminate(){if (numValues == 0){return SqlDouble.Null;}else{return (this.totalValue / this.numValues);}}// private accumulatorsprivate int numValues;private SqlDouble totalValue;}[Serializable][Microsoft.SqlServer.Server.SqlUserDefinedAggregate (Format.Native)]public struct TrimmedAvg{public void Init(){this.numValues = 0;this.totalValue = 0;this.minValue = SqlDouble.MaxValue;this.maxValue = SqlDouble.MinValue;}public void Accumulate(SqlDouble Value){if (!Value.IsNull){this.numValues++;this.totalValue += Value;if (Value < this.minValue)this.minValue = Value;if (Value > this.maxValue)this.maxValue = Value;}}public void Merge(TrimmedAvg Group){if (Group.numValues > 0){this.numValues += Group.numValues;this.totalValue += Group.totalValue;if (Group.minValue < this.minValue)this.minValue = Group.minValue;if (Group.maxValue > this.maxValue)this.maxValue = Group.maxValue;}}public SqlDouble Terminate(){if (this.numValues < 3)return SqlDouble.Null;else{this.numValues -= 2;this.totalValue -= this.minValue;this.totalValue -= this.maxValue;return (this.totalValue / this.numValues);}}// private accumulatorsprivate int numValues;private SqlDouble totalValue;private SqlDouble minValue;private SqlDouble maxValue;}*/--Test #2--Scenario G - Average Query using built-in aggregate--SELECT ProductID, Avg(Cast(PercentPassed AS float))FROM TestAssignmentGROUP BY ProductIDORDER BY ProductID--Scenario H - Average Query using CLR aggregate--SELECT ProductID, dbo.Avg_CLR(Cast(PercentPassed AS float)) AS AverageFROM TestAssignmentGROUP BY ProductIDORDER BY ProductID--Scenario I - Trimmed Average Query using built in aggregates/setoperations--SELECT A.ProductID,CaseWhen B.CountValues<3 Then NullElse Cast(A.Total-B.MaxValue-B.MinValue ASfloat)/Cast(B.CountValues-2 As float)End AS AverageFROM(SELECT ProductID, Sum(PercentPassed) AS TotalFROM TestAssignmentGROUP BY ProductID) ALEFT JOIN(SELECT ProductID,Max(PercentPassed) AS MaxValue,Min(PercentPassed) AS MinValue,Count(*) AS CountValuesFROM TestAssignmentWHERE PercentPassed Is Not NullGROUP BY ProductID) BON A.ProductID=B.ProductIDORDER BY A.ProductID--Scenario J - Trimmed Average Query using CLR aggregate--SELECT ProductID, dbo.TrimmedAvg_CLR(Cast(PercentPassed AS real)) ASAverageFROM TestAssignmentGROUP BY ProductIDORDER BY ProductID

View 9 Replies View Related

Failed To Load Expression Host Assembly. Details: The Type Initializer For 'CableReporting.Utilities' Threw An Exception

Sep 18, 2007

Hi

I am using sql reporting service 2005 with .NET 2.0.
I have created a custom dll file for report and put this dll in appropriate folder.
Report is running fine in designer project.
but when I am trying to view this report after uploading to report manager it give me an error like


Failed to load expression host assembly. Details: The type initializer for 'CableReporting.Utilities' threw an exception. (rsErrorLoadingExprHostAssembly)Is there any solution for that?

thanks and Regards

Apurv Shah
IBM India pvt Ltd

View 3 Replies View Related

Sql Programming

Mar 29, 2005

What I want to do is remove part of a result from a query. I am selecting the srvname from sysservers as follows.

SELECT srvname from sysservers
Where srvid ='0'

When the name is returned some times it might be like servernameinstance. What I need to do is cut off the and everything after that so that my result is just servername. I am then using this result in a cursor to go after server shares. The length of the servername varies. Any suggestions.

View 1 Replies View Related

Help DTS Job Programming

Mar 3, 2004

Hello:
I'm scheduling DTS packages to run as a job but when I do that, the job siply does not works, someone tolds me that it's a problem with the SQL and Windows NT authentication and security and he gaves me this URL http://support.microsoft.com/default.aspx?scid=kb;EN-US;Q269074.
but it not so clear to me, i'm working with SQL Server 200 and Windows Server 2000.

What can I do?

View 5 Replies View Related

SQL Programming

Apr 2, 2008

I dont know how to write a SQL Programming code from the table to the table (As the photo)


Would it be possable to help me?

Thanks so much!

View 10 Replies View Related

RMO Programming In VB.net

Aug 17, 2007

Hi,

Currently I am using the BCP functionality to import/export tables between different SQL Server 2005 databases. The process is working ok, but it creates alot of manual work, when 70 or more tables need to be transferred, every week. I am new to RMO development and am interested if the following may be possible.

- I would like to build an interface in VB.net allowing users to select a source database, and select the tables that need to be transferred from the Source DB, to the Destination DB.

-Put in place RMO funtionality to replicate the source database tables into flat files.

-Within the Vb.net app transfer the created flat files into the destination database.


I would greatly appreciate any advice on this, or if there may be a better approach at replacing the BCP functionality.

Thanks,



View 4 Replies View Related

Programming Help?

Jul 24, 2007

Hi,



Need help from experts on web service (ReportingService class).



I am trying to change a datasourcereference of a report from one location to another location. I am kind of stuck at this point where i am able to get the location but only dataSource.Item, dataSource.Name are not enough items for me to solve this problem.





any possible help or any threads already answered these type, greatly appreciated.



thanks

kodru.





View 1 Replies View Related

Programming Databaseconnections?

May 6, 2007

Hi!I want some tutorials on how to actually program database applications. Everything seems so bound with the data controls provided by Visual Studio and coming from PHP I don't like to not have full control over my applications. So where can I learn about creating my own database applications without using repeater, gridview or formview?Thank you in advance! 

View 1 Replies View Related

Programming Databases

Mar 30, 2004

I need to create a database with one table and its column names.
I got this script from the query analyzer templates as a database basic template:
IF EXISTS (SELECT *
FROM master..sysdatabases
WHERE name = N'<database_name, sysname, test_db>')
DROP DATABASE <database_name, sysname, test_db>
GO

CREATE DATABASE <database_name, sysname, test_db>
GO

I am not sure what it all means, what I need to do it name the database a certain name each time. and then create one table with 6 column names.

can someone give me guidance please...

View 7 Replies View Related

Transact-SQL Programming

Aug 3, 2000

I have a table containing almost 700000 records. The table contains the following fields:

table_id, member#, car_eff_dt, car_term_dt, mbr_occur.

A member can occur more than one time and his effective date/termination date are sorted sequentially.

An example would look like this:

table_id member# car_eff_dt car_term_dt mbr_occur
1 12345678901 01/01/1995 12/31/1995 null
2 12345678901 01/01/1996 12/31/1996 null
3 12345678901 01/01/1997 12/31/1997 null
4 10987654321 07/15/1998 02/16/1999 null
5 10987654321 04/01/2000 12/31/9999 null

Using Transact-SQL, is it possible to generate a unique number for each occurance of a particular member#?

table_id member# car_eff_dt car_term_dt mbr_occur
1 12345678901 01/01/1995 12/31/1995 1
2 12345678901 01/01/1996 12/31/1996 2
3 12345678901 01/01/1997 12/31/1997 3
4 10987654321 07/15/1998 02/16/1999 1
5 10987654321 04/01/2000 12/31/9999 2

Currently, I am running the code in an Access/VBA module through an ODBC connection, but I would like to be able to run all my code directly on the server.

Thanks in advance for any help you might be able to provide.

View 1 Replies View Related

Programming Editor

Dec 16, 1999

Just curious,

What do all of you use to create and edit stored procedures? I am looking for a better way to code than to use the default window supplied with Enterprise Manager.

Do most of you use the Query Analyzer? Are there third party products you like using better?

Thanks for the info..

Eugene

View 2 Replies View Related

What Programming Language Is Behind SQL?

Dec 9, 2004

I am looking into a production geared software called MassGroup. (www.massgroup.com) It says that its FactoryServer builds are on a standardized SQL framework and web architecture for data collection, work order requests, reporting and asset management. My questions are:

1. Is SQL its own programming language? If not what is it?
Answer: After going thru several pages and reading the fine print I discovered they use VB, ASP, COM technology, and Crystal Reports.

2. How powerful do you think this would be at gathering data and does it have the capability of creating a number sequence automatically? (example: 0001; 0002; 0003...)

Any help would be appreciated.
Thank you in advance!!!!!

View 1 Replies View Related

Web Database Programming

Nov 22, 2004

hi to all,

What is the best language or compiler used in web database programming. Any have an idea pls help me.


Thankss.

View 2 Replies View Related

Help!! Hate Programming Sql

Mar 3, 2008

I have just started in Sql 6 months ago. I was an IT major in graduate school and am now in my late 30's (career change). It took me 4 years to finally get what I thought was my dream job. Well, I was promised training which I have yet to receive and bascially went from doing basic queries that I did in class in college to doing advance Sql - stored procs, etc. I completely hate it. I do not know if it is from the lack of training or if it just not for me. I am completely bored out of mind. I am also tired of struggling everyday to complete assignments. The first 2 assignments I received were way out of my league. I was told this by a project mgr who did a similiar assignment and they have years of sql experience and it took her 3 months with assistance to complete it. I have been with the company for almost 6 years. I am not sure if I should just complete my current assignments and ask if they can reassign me to a different IT department, look for a new job or just continue to struggle and pull my hair out. Please give me some feedback as to how you would handle this situation.

View 8 Replies View Related

Other Programming Skills- CLR

Mar 25, 2008

Guys ..Im a very very confused Jr DBA/Dev here !

I need to know what exactly other languages [C#/VB.net/ADO/XML/ASP.net..etc] that I should learn in order for me to be able to excel in SQL Development.

I started getting my hands dirty with some SSIS / SSRS & SSAS, but inorder for me to handle situations such as [Find if file exist in ftp before loading, Checking a certain row of a data file before processing/ Zipping and Unzipping data files and etc...] What should I need to know well in order for me to add more value to my skills?
I would like to learn 1 language and master it pretty well.What are your suggestions?

And what is this CLR that is being talked about ?Does it use other language besides SQL?

Do guide this lost JR .......

View 10 Replies View Related

C++ And SQL Server Programming

Dec 25, 2005

Are there any good resources (books, websites, etc) for programming SQLServer using Visual C++? I am currently using C# but I really want to learnhow to do it using C++, but it appears to be much more difficult using C++.Thanks

View 2 Replies View Related

.sdf Databasse And Programming

May 15, 2007

i need to access an .sdf database using microsfot visual forpro

what drivers/connection strings do i need?

View 1 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved