Showing posts with label sqlclr. Show all posts
Showing posts with label sqlclr. Show all posts

Monday, March 12, 2012

Getting proc name from within .Net code

Hi,

I'm currently in the midst of writing my first sqlclr sproc.

In our normal T-SQL sprocs we use the following:

OBJECT_NAME(@.@.PROCID)

to get the name of the sproc. We later use the result of this as a parameter to a custom message when we use RAISERROR.

Question is, is there a way of doing the same from within a SQLCLR sproc? i.e. Can someone give me a bit of code that will return the name of the current sproc? (Obviously this is not the same as the name of the .Net class that implements my sproc).

Thanks in advance for any help that you can provide.


Regards

I've had word from Umachander at MSFT who says that this isn't possible but that they are looking at it for a future version.

-Jamie

Sunday, February 19, 2012

Getting error in registering the SQLCLR procedure...

hi, Derek Comingore

My self Jitendra Nayi....

I am trying to generate a SQL CLR stored procedure and i have done it too. Now the next step is to convert that *.dll file in to assembly. I am getting erro that. My server Database is on the LAN, not on my PC.

Here is the code which i have tried to register an assembly...

/*

CREATE ASSEMBLY MyAssembly FROM 'C:\Documents and Settings\Administrator.ORC80\My Documents\Visual Studio 2005\Projects\MyDB1\MyDB1\bin\Debug\MyDB1.dll'

WITH PERMISSION_SET=SAFE

GO

*/

and here is the error that i am getting...

/*

Msg 6585, Level 16, State 1, Line 1

Could not impersonate the client during assembly file operation.

*/

Please help me .I am stuck at here.

Are you running as a Windows login or SQL login? Only Windows logins can read assemblies in create assembly.|||In addition to what Mark B says in his reply; your CREATE ASSEMBLY statement references an absolute path to the assembly. Does the server box have access to this path and is the path visible to the server box?

Niels