I have to work on an existing application, comprises of many projects including a database project.
In the statup project, which is a windows app., when making a call to a
This worked for me
EXEC sp_configure 'show advanced options', '1';
GO
RECONFIGURE;
GO
--Enable CLR (.NET Common Language Runtime)
exec sp_configure 'clr enabled', '1';
GO
RECONFIGURE;
GO
--Enable xp_CmdShell stored procedure to run Command Line programs from within T-SQL
--EXEC sp_configure 'xp_cmdshell', 1
--GO
EXEC sp_configure 'show advanced options', '0';
GO
RECONFIGURE;
/****this is another one****/
USE master
GO
ALTER DATABASE <DB_NAME>SET TRUSTWORTHY ON
USE <DB_NAME>
GO
EXEC sp_changedbowner 'sa'
/****when error occured relating to m,emory***/
The stack trace points to an assembly it could not load. If you're using .dll files to build or load anything (data import/export), you may want to start there.
Check to make sure the assembly is the proper version for your application, or that it even exists within the directory.
Also, double check the naming convention in the assembly. The stack trace shows an assembly name or codebase being invalid. Is the language parseable within your application? Is there a typo in the name?
These may be really elementary places to start, so my apologies if you've tried these. I've run into traces like this before, and it my case it usually amounted to a missing .dll or version incompatibility.
Ensure that the assembly you are using the xxxxx.yyyy.database assembly from is not targeting an older version of the .NET Framework.
This did the trick for me:
USE <DATABASE>;
EXEC sp_configure 'clr enabled' ,1
GO
RECONFIGURE
GO
EXEC sp_configure 'clr enabled' -- make sure it took
GO
USE <DATABASE>
GO
EXEC sp_changedbowner 'sa'
USE <DATABASE>
GO
ALTER DATABASE <DATABASE> SET TRUSTWORTHY ON;
At long last, I could fix it,
Thanks for all comments/answers.