RE: Transact: GRANT LOGIN

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



If you do a sp_helptext 'sp_grantlogin', you'll see the folllowing code
segment:

-- DISALLOW SQL LOGIN (IE. MUST BE 'DOMAIN\USER') --
if (charindex('\', @loginame) = 0)
begin
raiserror(15407, -1, -1, @loginame)
return (1)
end

In other words, you can use sp_grantlogin to create a SQL login. If you are
CREATE LOGIN, continue to use it and you don't need to use sp_grantlogin.

Linchi

"Bruno" wrote:

Hi All,

I am trying to programatically manage user accounts (SQL Server 2005
Express).

At this stage I am really only issuing transact commands from within
Management Studio Express and see how they work. later I'll
encapsulate those in my Delphi application.

So far, all I can do is create a new login. I understand that I also
need to GRANT login as well as select, insert, update, delete rights
to any new user.

I have looked up the syntax for doing this, but when trying to grant
login rights to a newly created user, I get an error message.

This works:
create login testUser with password = 'testpsw'

But this doesn't:
exec sp_grantlogin 'testUser'

SQL Server says that 'testUser' is not a valid Windows NT name, and
asks me to provide a complete name: <domain\username>.

I want users to login with SQL, not Window authentication. Why should
I providea domain\username?

Thanks for any thoughts on this.
Bruno.

.



Relevant Pages

  • Cannot query a table without adding a prefix
    ... I'm using SQL 2005 by logging into SSMS via my own account, ... like to query without adding any prefix in the FROM clause like FROM testuser. ... When I login as testuser in SSMS and query a table, it works fine, However, ...
    (microsoft.public.sqlserver.security)
  • Re: Permission question - another one
    ... If I add an Sql Login it does add the TRAVAC\ in front of the names, ... seems to be users that were setup to use SQL Server Authentication. ... RAPTOR is the Server that has SQL Server running on it. ... > " I could think I am taking permissions away from someone, ...
    (microsoft.public.sqlserver.programming)
  • Re: SQL 2k5 SP2 Mirroring - SQL in Mixed mode.
    ... US\sqlservices (old SQLservice account) still member of built-in local admin ... Login: US\sqlservices ... How can I transfer the SQL logins to ... Here is SP_help_revlogin results from the Principal Server (NYSQL-3) ...
    (microsoft.public.sqlserver.clustering)
  • Re: Renamed Windows login not found in SQL Server 2000
    ... It's almost like SQL tuck some knowledge away in an area ... of memory that only gets released on Windows stop. ... > I am running SQL Server 2000 SP2 with Windows ... > login gets corrupted) I am unable to add the new login to ...
    (microsoft.public.sqlserver.security)
  • Re: SQL Server on XP Home Network
    ... The sa account is the system administrator "God" account witihin SQL ... This account is a SQL-Server login. ... You might be able to use Enterprise Manager to go in and create a new SQL ... Select the "SQL Server Authentication" ...
    (microsoft.public.sqlserver.setup)