Showing posts with label MSSQL. Show all posts
Showing posts with label MSSQL. Show all posts

Saturday, 7 September 2013

Enable CLR Integration in SQL Server 2008

Posted by Sarath On Saturday, September 07, 2013 No comments
By default the common language runtime (CLR) integration feature is turned off. If it is turned off, SQL server won't be able to access the custom assemlies that are part of your database (if the database contains objects that are coded to use CLR integration). CLRmust be enabled in order to use objects that are coded to use CLR integration.

To check :
Open SQL Management Studio, click on the "New Query" button. In the query window paste the following and click the "Execute" button :
Code: 
SELECT * FROM sys.configurations
WHERE name = 'clr enabled'

To enable CLR integration, use the clr enabled option of the sp_configure stored procedure:

Execute the below query :

Code: 
sp_configure 'show advanced options', 1;
GO
RECONFIGURE;
GO
sp_configure 'clr enabled', 1;
GO
RECONFIGURE;
GO

Then click the "Execute" button to run the stored procedure.

In the SQL Server "Messages" window you should see messages similar to below ones :
Configuration option 'show advanced options' changed from 0 to 1. Run the RECONFIGURE statement to install.
Configuration option 'clr enabled' changed from 0 to 1. Run the RECONFIGURE statement to install.

That's all..!!

Sunday, 26 August 2012

Check SQL connections

Posted by Sarath On Sunday, August 26, 2012 No comments
Login to SQL Management Studio, select Master database and click on New Query and paste the below code :
CREATE TABLE #sp_who2
    (SPID INT,

    Status VARCHAR(1000) NULL,
    Login SYSNAME NULL,
    HostName SYSNAME NULL,
    BlkBy SYSNAME NULL,
    DBName SYSNAME NULL,
    Command VARCHAR(1000) NULL,
    CPUTime INT NULL,
    DiskIO INT NULL,
    LastBatch VARCHAR(1000) NULL,
    ProgramName VARCHAR(1000) NULL,
    SPID2 INT,
    RequestID INT)  
GO
INSERT INTO #sp_who2
EXEC sp_who2
GO
SELECT Login, DBName, count(Login) AS Connections
FROM #sp_who2
GROUP BY Login, DBName
ORDER BY Connections DESC
GO
DROP TABLE #sp_who2
GO

Click on Execute button, and it will show the current connections to the SQL database server.
That's it...