creating new user in sql

  • hi

    i am developing an application using java for administration of sql.....i want to create new user for sql server data bases access.....can anbody tell me how i can create new user or login using query....

    i shall be very thankful

    regards

    muddsar

  • You can use the system stored procedure sp_addlogin for a SQL Server-based user. You can use sp_grantlogin to grant access to a Windows user or group.

    K. Brian Kelley
    @kbriankelley

  • thanks for ur reply....can u plz tell me the syntex to execute a stored procedure?

    plz give example

  • Although we love helping, we can't do everything.

    A bit of light reading may be in order.

    From Sql Books online.

    http://msdn.microsoft.com/library/default.asp?url=/library/en-us/tsqlref/ts_sp_ga-gz_8dri.asp

     

  • /*add the user to the sql login */

    EXEC sp_addlogin @username,@Password,'pubs'

    EXEC sp_grantdbaccess @username,@username

    refer to BOL for explanations


    Everything you can imagine is real.

Viewing 5 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic. Login to reply