Microsoft Sql Server Error 15007
Contents |
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company Business Learn is not a valid login or you do not have permission sql server 2008 r2 more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags
Is Not A Valid Login Or You Don't Have Permission Sql Server 2008 R2
Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 6.2 million programmers, just like msg 15007, level 16, state 1 you, helping each other. Join them; it only takes a minute: Sign up Create a user for SQL Server 2008? up vote 7 down vote favorite 2 I'm using this code to create a new user. /****** Object: is not a valid login or you don t have permission sql server 2012 User [primebox] ******/ IF NOT EXISTS (SELECT * FROM sys.database_principals WHERE name = N'primebox') CREATE USER [primebox] FOR LOGIN [primebox] WITH DEFAULT_SCHEMA=[primebox] GO and I got the following error when I try to create this specific user. Msg 15007, Level 16, State 1, Line 1 'primebox' is not a valid login or you do not have permission. The part that I don't understand is, I can create others users but this one in particular looks invalid
Sql Server 2012 Create User
I tried to rename my database and got this error Unable to rename primeboxs. (ObjectExplorer) Rename failed for Database 'primebox'. (Microsoft.SqlServer.Smo) An exception occurred while executing a Transact-SQL statement or batch. (Microsoft.SqlServer.ConnectionInfo) The database could not be exclusively locked to perform the operation. (Microsoft SQL Server, Error: 5030) My guess is that the problem is the database name... but I got the code from another database (I'm creating a 'wanna be' backup) with the same user and database names. So I'm in a corner here... Any help will be a LOT appreciated =) PS: My computer name is box, windows 7. Using SQL Server 2008 sql-server-2008 user share|improve this question edited Oct 29 '12 at 15:02 marc_s 454k938701032 asked Oct 29 '12 at 14:34 Michel Ayres 2,82463760 add a comment| 3 Answers 3 active oldest votes up vote 9 down vote accepted In SQL Server, users are different to logins. To create a user for a database, you first have to create a login for the server using the create login syntax share|improve this answer answered Oct 29 '12 at 14:36 podiluska 39.7k54863 add a comment| up vote 16 down vote Logins are different things than users, here is how to create a new LOGIN. Right click SQL Server Management Studio and choose -> Run as adminstrator. Login normally with the default Windows Authentication. Choose
Recent PostsRecent Posts Popular TopicsPopular Topics Home Search Members Calendar Who's On Home » SQL Server 2008 » SQL Server 2008 - General » Can't create login sql server create users -- permissions issue 24 posts,Page 1 of 3123»»» Can't create users -- permissions issue Rate Topic Display Mode Topic Options Author Message Ray KRay K Posted Wednesday, January 4, 2012 9:05 AM SSCrazy Group: General Forum Members Last Login: Yesterday @ 11:27 AM Points: 2,486, Visits: 4,429 Hey guys . . .My computer was hit with a virus last week, so I had to wipe the drive http://stackoverflow.com/questions/13123682/create-a-user-for-sql-server-2008 and rebuild. I've ben trying to reinstall and rebuild everything that I had before.One of them is SQL 2008. I'm trying to recreate my staging database environment locally on my machine. I went to the database server, generated a script, and tried to run it locally on my machine.When I run the script, I get the following when I try to create users (user and schema names changed to protect http://www.sqlservercentral.com/Forums/Topic1230029-391-1.aspx the innocent):Msg 15007, Level 16, State 1, Line 2'UserName' is not a valid login or you do not have permission.This line is generating the error:CREATE USER [UserName] FOR LOGIN [UserName] WITH DEFAULT_SCHEMA=[SchemaName]This is happening regardless of the user name I'm trying to create.I figure it's a permissions issue somewhere, but I can't figure out where to look. BOL hasn't been very helpful (although I'm still looking).Can one of you point me in the right direction?Thanks, guys! +--------------------------------------------------------------------------------------+Check out my blog at https://pianorayk.wordpress.com/ Post #1230029 DevDev Posted Wednesday, January 4, 2012 9:10 AM SSCommitted Group: General Forum Members Last Login: Saturday, August 8, 2015 4:20 AM Points: 1,932, Visits: 1,598 It’s your own system so I am asking it, Are you not using sa login for running the scripts? Dev*** Open Network for Database Professionals ***http://www.linkedin.com/in/devendrashirbad Post #1230037 GilaMonsterGilaMonster Posted Wednesday, January 4, 2012 9:13 AM SSC-Forever Group: General Forum Members Last Login: Today @ 9:32 AM Points: 45,423, Visits: 43,752 What are you logged in as? SQL login or windows login? What permissions does that login have?Does the login 'UserName' exist? Gail ShawMicrosoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)SQL In The Wild: Discussions on DB performance with occasional diversions into recoverabilityWe walk in the
for Help Receive Real-Time Help Create a Freelance Project Hire for a Full Time Job Ways to Get Help Ask a Question Ask for Help Receive Real-Time Help https://www.experts-exchange.com/questions/28480582/I-am-trying-to-add-a-login-to-a-sql-server-express-database-but-am-getting-an-error.html Create a Freelance Project Hire for a Full Time Job Ways to Get Help Expand Search Submit Close Search Login Join Today Products BackProducts Gigs Live Careers Vendor Services Groups Website Testing Store Headlines Experts Exchange > Questions > I am trying to add a login to a sql server express database but am getting an error sql server Want to Advertise Here? Solved I am trying to add a login to a sql server express database but am getting an error Posted on 2014-07-21 MS SQL Server 1 Verified Solution 4 Comments 756 Views Last Modified: 2014-07-22 I don't know a lot about SQL server Express but I need to create a login account so that is not a I can connect with something other than windows authentication. I'm trying the following (password blanked out for security) but I'm getting errors. Does anyone know what I'm doing wrong? Nothing is connected to the database other than SQL Server Management Studio. USE [master] GO CREATE LOGIN [LEadmin] WITH PASSWORD=N'******' MUST_CHANGE, DEFAULT_DATABASE=[LE_tool_sql2SQL], DEFAULT_LANGUAGE=[us_english], CHECK_EXPIRATION=ON, CHECK_POLICY=ON GO EXEC master..sp_addsrvrolemember @loginame = N'LEadmin', @rolename = N'dbcreator' GO EXEC master..sp_addsrvrolemember @loginame = N'LEadmin', @rolename = N'securityadmin' GO EXEC master..sp_addsrvrolemember @loginame = N'LEadmin', @rolename = N'sysadmin' GO USE [LE_tool_sql2SQL] GO CREATE USER [LEadmin] FOR LOGIN [LEadmin] GO Getting the following errors Msg 945, Level 14, State 2, Line 1 Database 'LE_tool_sql2SQL' cannot be opened due to inaccessible files or insufficient memory or disk space. See the SQL Server errorlog for details. Msg 15007, Level 16, State 1, Procedure sp_addsrvrolemember, Line 68 'LEadmin' is not a valid login or you do not have permission. Msg 15007, Level 16, State 1, Procedure sp_addsrvrolemember, Line 68 'LEadmin' is not a valid login or you do not have permission. Msg 1500