You can either use Uri.UnescapeDataString (in System
), in which case you will also need to do a Replace('+', ' ')
on the string before passing it to Uri.UnescapeDataString
, or if you would rather not bother with it, this function is available in the Free version of SQL# (which I am the author of).
Importing System.Web
is probably more work than it's worth. And in fact, it can be risky. There is a good reason that System.Web
is not in the "Supported Libraries" list that you linked to in the question: it is not guaranteed to work! You might run into situations, especially when dealing with non-US ASCII character sets, that do not behave as expected, and Microsoft will not fix it. So, unless you absolutely have to, you should be careful about adding non-supported DLLs. The DLLs in the "Supported" list have been fully tested and verified to work with SQL Server collations and any other environmental issues that are different between standard CLR running in Windows and the CLR running inside of SQL Server.
Here are some additional resources from Microsoft regarding several pitfalls to incorporating unsupported .NET Framework libraries:
A few notes about your code:
- Please do not use .NET types for parameters, input or output. Hence, change
string encodedXML
to be SqlString encodedXML
.
- This function is deterministic so should be marked as such, else you will suffer a performance hit. Add
IsDeterministic = true
to the SqlFunction
attribute.
Could not find database engine startup handle error means SQL Server installation was able to install SQL Server services but when installation is trying to start SQL Server services its failing.
A simple solution I mentioned In This Technet Article is
Please go to SQL Server configuration manager and locate the SQL Server services
Right click on SQL Server express service and select properties and change startup account to Local System and select apply then OK. This will start services with Local system account privilege.
Certain reasons which can cause this error.
The account which user selected on Server Configuration page window ( during installation) is somehow not able to bring SQL Server database engine services online. Either is lacks privilege or it is corrupted. During installation of database engine services SQL Server tries to bring online database services as a internal process but due to startup account either corrupt or not having appropriate privileges it fails to do so and ultimately installation fails.
Other reason is when installation fails first time due to some reason and user uninstall failed installation from add remove program, the un-installation leaves account in broken state so any further attempt to install flashes this error message.
The reason can be also that SQL Server installation was successful in installing SQL Server and its services but due to some other limitation in system or other system related errors SQL Server is not able to come online.
In Your case reason is
2015-02-08 19:55:06.16 spid14s Error: 17190, Severity: 16, State: 1.
2015-02-08 19:55:06.16 spid14s Initializing the FallBack certificate failed with error code: 1, state: 20, error number: 0.
2015-02-08 19:55:06.16 spid14s Unable to initialize SSL encryption because a valid certificate could not be found, and it is not possible to create a self-signed certificate.
2015-02-08 19:55:06.16 spid14s Error: 17182, Severity: 16, State: 1.
To solve this Either start SQL Server service account with Local System or Create a new local account having admin privileges on the local machine and try starting SQL Server service with that account. This Blogs.msdn article says such error can come if account profile is corrupt
As you are already aware running SQL Server service with account having admin privileges is not advised. In such case for time being you can run the account with local system but you can use Configure Windows Service Account and Permissions to create account with minimum privileges.
EDIT:
FCB::Open failed: Could not open file
E:\sql12_main_t.obj.x86Release\sql\mkmastr\databases\mkmastr.proj\MSDBData.mdf for file number 1. OS error: 2(The system cannot find the file
specified.).
2015-02-09 10:42:45.12 spid8s Error: 5120, Severity: 16, State:
101.
2015-02-09 10:42:45.12 spid8s Unable to open the physical file
"E:\sql12_main_t.obj.x86Release\sql\mkmastr\databases\mkmastr.proj\MSDBData.mdf".
Operating system error 2: "2(The system cannot find the file
specified.)".
2015-02-09 10:42:45.12 spid8s Error: 17207, Severity: 16, State:
1.
As per below logs SQL Server is searching for msdb file at location
E:\sql12_main_t.obj.x86Release\sql\mkmastr\databases\mkmastr.proj\
Can you manually move both msdb data file and log file to above location. I know this is not your desired location but let first SQL Server come online then we can use alter database command and change location to what ever suits you. To me this is bug and is happening because SQL Server is unable to ,somehow, decide the location of msd files and so choosing random location.
Revert if this does not works
Best Answer
The Details.txt log shows an error of:
As the first error that occurs, when it initially attempts to connect to the database engine. This might be the better error to chase down, since it seems to indicate something interfering with the connection. A quick search shows some similar with people running Lavasoft (Adaware, etc) Software - any chance you're running this?