This is my problem: I do not know how to get the servername from a C# user defined function . Is this possible?
I am writing a User Defined Function (UDF). Inside of this user defined function I need the name of the databaseserver that it is running on. Does anyone have an idea how I might do this? Is there an enviromental variable that I could access within the C# code I use to write the UDF?
I could always use a parameter to pass in the name of the server, but I would like to have as few parameters as possible.
Thanks in advance,
Sean
? Use the context connection and do: SELECT @.@.SERVERNAME -- Adam MachanicPro SQL Server 2005, available nowhttp://www..apress.com/book/bookDisplay.html?bID=457-- <Sean Finn@.discussions.microsoft..com> wrote in message news:b8ac5ded-8e34-4923-a0d9-2d01409c9c0d_WBRev1_@.discussions..microsoft.com...This post has been edited either by the author or a moderator in the Microsoft Forums: http://forums.microsoft.com This is my problem: I do not know how to get the servername from a C# user defined function . Is this possible? I am writing a User Defined Function (UDF). Inside of this user defined function I need the name of the databaseserver that it is running on. Does anyone have an idea how I might do this? Is there an enviromental variable that I could access within the C# code I use to write the UDF? I could always use a parameter to pass in the name of the server, but I would like to have as few parameters as possible. Thanks in advance, Sean|||Or without issueing a command,you could use just:
SqlConnection conn = new SqlConnection("context connection=true");
conn.Open();
// conn.Database --> hold the string of the database name
conn.Close();
HTH, Jens Suessmeyer.
http://www.sqlserver2005.de
No comments:
Post a Comment