Monday, March 19, 2012

Another SQL script question.

Hey all,

How do i make sure that the local machine aspnet user account has privilages after installing my sql script on a local machine. ( this script gets run during my vb.net setup project. )

i was thinking about adding the user to the sql script its self. but i am unsure how to do this.

if anyone could help i would be greatly appreciative.

TIA

-Chris-Check out this link.

The link is for MSDE but applies to Sql Server too. It shows the syntax for adding new users to a database server and granting them access to specific databases.|||Thanks for you reply.

the syntax for adding a user assumes you know the full nt user account info. correct?

domain\user account.

what i would like to do is add the local machine\aspnet account. without knowing what the name of the local machine is.

if you have suggestion, please let me know.

TIA

Chris.|||I've gotten around that problem by using Sql Server authentication instead of a trusted connection.


-- Create Sql authentication login for 'SomeName'
EXEC sp_addlogin @.loginame='SomeName',@.passwd='SomePassword',@.defdb=N'SomeDefaultDb'
-- and making sure you are executing from 'SomeDatabase' grant access to 'SomeName' to the database 'SomeDatabase'
EXEC sp_grantdbaccess 'SomeName'

There is probably some server side property or method you can call that will tell you who the ASPNET user is running as (e.g., domain\ASPNET) which would allow you to use the other syntax to create a trusted connection.

No comments:

Post a Comment