EXEC(@sql)
Blogging about SQL Server, SQL XML and related technologies.
  • SQL
  • SQL XML Bulk Load
  • XML
  • Archive
Cleaning a DateTime for the time portion/Converting DateTime. Select/Edit rows and Saving Changes is not permitted.

Assign orphan users to a new login

Jan 092009

If you need to assign an orphan user in MS SQL 2005 – meaning a user without a log in – to a new login, or change the login for a user, simply run the following query:

ALTER USER <userName> WITH login = <loginName>

on the database.
This is a problem which can happen if you for example restore databases to a new server, where you have a user in the database, but no mapped login.

  • January 9, 2009
  • Posted by Allan S. Hansen at 10:13
  • Add comments
  • SQL
  • Tagged with: login, restore

Leave a Reply Cancel reply

(required)

(required)

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Tags

@@rowcount aggregation bulk case char common table expression connections count datetime dynamic error execution plan group by identity import in indexes inner join insert insert into IsNumeric left join linebreaks max merge not in order by output partitioning performance rollback scope select self join sproc sql xml bulk load stored procedures str subquery transaction update varchar variables xml xsd

Recent Posts

  • SQL XML Bulk Load and Namespaces
  • COUNT on LEFT JOIN
  • The select list for the INSERT statement contains fewer items than the insert list. The number of SELECT values must match the number of INSERT columns
  • Migrating to wordpress
  • @@rowcount and print
  • The MERGE syntax – syntax and performance
  • A STR issue
  • Changing domain
  • SQL XML Bulk Load – more XSD syntax
  • SQL XML Bulk Load, Relationships and composite keys

Most popular posts

  • An explicit value for the identity column in table can only be specified when a column list is used and IDENTITY_INSERT is ON.
  • Bringing a database out of Restoring state in SQL Server 2005
  • Drop User: The database principal owns a schema in the database, and cannot be dropped
  • Linked Servers in SQL Server 2005
  • Dynamic ASC and DESC and Order by DateTime

Follow EXEC(@sql)

RSS Feed

Find me on…

View Allan Svelmøe Hansen's profile on LinkedIn  

Svelmoe on Twitter

  • Number 1 annoyances when working with databases..... difference in collation between the databases. #SQL 1 hour ago
  • Windows software that doesn't shut down when pressing the X icon should be smacked around #spotify #fail 1 hour ago
  • Longest PROC to date: 591 lines ... wonder if I should wrap it in text and EXEC it, so I could loop and replace some values. #SQL 2 days ago
  • #TGIF 3 days ago
  • Finding it a bit fun when using the RIGHT function to 'PAD LEFT ' in #TSQL #SQL #geek 4 days ago
© 2011 EXEC(@sql) Suffusion theme by Sayontan Sinha