Showing posts with label urgent. Show all posts
Showing posts with label urgent. Show all posts

Wednesday, March 21, 2012

HOW TO LOGIN IN TO SQL EXPRESS AND HOW TO ATTACH DATABASE PLZZ ITS URGENT

Hi

i am developing an installer for our produce where there is a need to install sqlexpress and then i have to attach the database to that but i am unable to understand how to do that , i any one can help in this issue plss

To install SQL Express you need to include the installer and then pass command line parameters to it. This link will help http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnsse/html/EmSQLExCustApp.asp

Now to attach a database, you need to create the database, then detach it, now you have an .mdf and an .ldf file. You need to include that in the installer, then once SQl Express is installed on the customer machine you need to re-attach it, you can do this by using the sp_detach, called through sqlcmd on or a sqlclient sqlcommand object.

Sunday, February 19, 2012

How to know if a user has UNSAFE ASSEMBLY permission

Hi All,

How can I know if a user has UNSAFE ASSEMBLY permission on master database by executing query.

Please assist its really urgent, as I m stuck on this.

See SQL Server 2005 Books Online:
ALTER ASSEMBLY (Transact-SQL)
http://msdn2.microsoft.com/en-us/library/ms186711.aspx

Creating an Assembly

http://msdn2.microsoft.com/en-us/library/ms345106.aspx

Users don’t have UNSAFE ASSEMBLY permission on master database but maybe you are looking for this:

SELECT pr.name

FROM sys.server_principals pr

INNER JOIN sys.server_permissions pe

ON pr.principal_id = pe.grantee_principal_id

WHERE pe.permission_name = 'EXTERNAL ACCESS ASSEMBLY'

If you want to change permision on as assembly:

To alter an assembly whose existing permission set is UNSAFE requires membership in the sysadmin fixed server role.

To change the permission set of an assembly to UNSAFE requires membership in the sysadmin fixed server role.

If you are creating assemblies:

We recommend that the TRUSTWORTHY Database Property on a database not be set to ON only to run common language runtime (CLR) code in the server process. Instead, we recommend that an asymmetric key be created from the assembly file in the master database. A login mapped to this asymmetric key must then be created, and the login must be granted EXTERNAL ACCESS ASSEMBLY or UNSAFE ASSEMBLY permission.

USE master GOCREATE ASYMMETRIC KEY SQLCLRTestKey FROM EXECUTABLE FILE = 'C:\MyDBApp\SQLCLRTest.dll'CREATE LOGIN SQLCLRTestLogin FROM ASYMMETRIC KEY SQLCLRTestKeyGRANT EXTERNAL ACCESS ASSEMBLY TO SQLCLRTestLogin GO


|||

Hey Ikh,

Truly speaking, I m not finding words to thank you.

Your reply is exactly what I was looking for.

Thank you very …………………… much .

Actually the scenario at my end is that. In our project we have used an Assembly with UNSAFE Permissions. Now before installing the product we need to check whether the user has permissions to Access the UNSAFE ASSEMBLY.

Your reply is the exact answer to my question

Thanks again for spending time in replying to me.

Have a good time ahead!