Antonio’s Blog

Entries for the ‘Databases’ Category

Fixing Orphan Users on SQL Server

2 queries to find and fix orphan users on a SQL Server Database…
sp_change_users_login
Displays which users have no login name mapped to them
sp_change_users_login ‘Report’
Update an orphan username
sp_change_users_login ‘Update_One’, ‘username’, ‘login_username’
Enjoy!

Update data using 2 or more tables – T-SQL

It happens quite frequently that I need to update data using data from a different table… really useful…
UPDATE a
SET a.Col1 = b.Col1
FROM table1 a JOIN table2 b ON a.Col2 = b.Col2
WHERE <Conditions>

  
Get Adobe Flash playerPlugin by wpburn.com wordpress themes