Ever restored a database in SQL Server. And then had all this disconnected logins hanging around. Logins in the database that got restored, but have no SQL Server login name associated with them. Fear no more, here's the help:
sp_change_users_login
And here's how to use it:
sp_change_users_login @Action='Update_One', @UserNamePattern='dbuser', @LoginName='sysuser', @Password=Null
This will reconnect the database user dbuser with the login name in the system sysuser. Normally both user names are the same.
Enjoy
20070524
20070518
SQL Server 2005 Management Studio Scripting
Something that bugs me now and then. using SQL Server 2005 Management Studio to script tables and stored procedure is really a great tool. Couldn't do without it and would certainly have to write something similar. Except now and then it throws all the object definitions into a EXEC dbo.sp_executesql @statement = N format, and that throws me off, and doesn't smell right.
Then I go scrambling, trying to figure out which of the many scripting options it is that sets this up.
For my own future sanity and for anybody who cares, it is (drum roll):
Include IF NOT EXISTS clause
Which makes sense, since then the whole definition needs to fit in an if clause.
Then I go scrambling, trying to figure out which of the many scripting options it is that sets this up.
For my own future sanity and for anybody who cares, it is (drum roll):
Include IF NOT EXISTS clause
Which makes sense, since then the whole definition needs to fit in an if clause.
20070509
.NET String Format
How many times have you sat there and browsed MSDN for a comprehensive list of format strings in .NET ?
I've done it countless times, and while the documentation is technically accurate, it is missing an essential overview in one spot.
Here is my two alternative SteveX Compiled » String Formatting in C#
Enjoy
I've done it countless times, and while the documentation is technically accurate, it is missing an essential overview in one spot.
Here is my two alternative SteveX Compiled » String Formatting in C#
Enjoy
Subscribe to:
Posts (Atom)