Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion Groups
DB Engine
SQL ServerMSDESQL Server CE
Services
Analysis (Data Mining)Analysis (OLAP)DTSIntegration ServicesNotification ServicesReporting Services
Programming
CLRConnectivitySQLXML
Other Technologies
ClusteringEnglish QueryFull-Text SearchReplicationService Broker
General
Data WarehousingPerformanceSecuritySetupSQL Server ToolsOther SQL Server Topics
DirectoryUser Groups
Related Topics
MS AccessOther DB ProductsMS Server Products.NET DevelopmentVB DevelopmentJava DevelopmentMore Topics ...

SQL Server Forum / Programming / CLR / November 2008

Tip: Looking for answers? Try searching our database.

Deploy C# stored procedures

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Lubomir - 27 Aug 2008 22:06 GMT
Hi,

We have the OurStoredProcedures.dll with stored procedures in C#. We
programatically deploy these stored procedures to the local SQL Server, using
SQL command with the "CREATE PROCEDURE ..."statement. Also we are creating an
assembly on the server.

Now we are going to do this with the remote SQL Server, what brings these
questions:

1/
I would like to know, if the SQL Server needs that OurStoredProcedures.dll
will be accessible during the execution of the stored procedures, or: are
these stored procedures created and stored in a binary form somwhere on the
Sql Server, so after deploying the *.dll file is not needed anymore?

2/
It he file must be present while the stored procedures are called, where is
the best place to put this dll? (SQL Server will be running on a remote
dedicated machine)

Thanks for help,
Lubomir
Bob Beauchemin - 28 Aug 2008 00:46 GMT
Hi Lubomir,

The assembly is stored on the server after you run CREATE ASSEMBLY. For
access to it, use the SQL statement "select content from sys.assembly_files
where name = 'your_assembly_name_here' ". Once you run CREATE ASSEMBLY, you
do not need access to the original file. SQL Server will not use it.

You can move assemblies in a few different ways.

1. If you move the .DLL to the remote server, the SQL Server principal
executing CREATE ASSEMBLY must have windows access to the file.
2. Alternately, if you have the assembly already cataloged to a test system,
you can right-click on [your
database]/Programmability/Assemblies/[your_assembly] and select "Script
Assembly as" then "Create to" then "File". You now have a file that contains
the DDL to re-create the assembly on the production system. It catalogs the
assembly from the binary held in the 'content' field in sys.assembly_files.

Each way has its strengths and weaknesses. Moving the file means you need to
keep the location of the file and the DDL that run CREATE ASSEMBLY in sync.
Scripting the assembly is simpler (no assembly .DLL to keep track of), but
corrupting the binary (for example, by sending the Create Script in mail and
introducing a carriage return-line feed in the binary) is possible.

Hope this helps,
Bob Beauchemin
SQLskills

> Hi,
>
[quoted text clipped - 23 lines]
> Thanks for help,
> Lubomir
Lubomir - 28 Aug 2008 01:04 GMT
Hi Bob,

Thanks.

Lubomir

> Hi Lubomir,
>
[quoted text clipped - 51 lines]
> > Thanks for help,
> > Lubomir
Kaleem Khan - 12 Nov 2008 22:12 GMT
I have some what related issue. Actually we are migrating from SQL Server
2005 to SQL Server 2008. Everything seems smooth but there is a problem
accessing report from report server page. This reports calls a stored
procdure in the dll. I have used 'create assembly' to deploy and then create
procdure.

The reports that have queries built into template means not calling SPs are
displayed fine while accessing them from report server pages.

There is no problem at all generating report from within BI Studio on the
same server machine.  

The error message is:

Failed to load expression host assembly. Details: Attempted to perform an
operation that was forbidden by the CLR host.
(rsErrorLoadingExprHostAssembly)

Can you please advise something?

> Hi Lubomir,
>
[quoted text clipped - 51 lines]
> > Thanks for help,
> > Lubomir
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



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