Tag Archives: SQL

Relinking users after restore

After restoring, sometimes I found that I have a user in the database, but it’s not linked to a global user.  Found this to work:

sp_change_users_login ‘auto_fix’, ‘SOME_USER’

Oh yeah – I first created the user under the top-most Security folder and then ran this on the specific database.

Found it here.

Advertisements

Leave a comment

Filed under Development

Getting Random Values in TSQL

After a bit of research, finally found the answer to how to set up random values for each record in SQL Server:

rand( CAST( NewID() AS varbinary) )

Continue reading

Leave a comment

Filed under Tech