Monday, February 22, 2016

Uninstall dropbox without losing files

Say you're stop using a computer, and need to stop sharing your dropbox files on this computer, or maybe to uninstall dropbox. How can you do it safely without losing files?

You need to unlink the computer with your dropbox account. Here is an article:

3 Easy Ways to Unlink a Computer from a Dropbox Account
 
 

Tuesday, January 19, 2016

Move MSSQL database file path

The solution if found at: https://msdn.microsoft.com/en-us/library/ms345408.aspx


The steps are:

1) Change file path:
ALTER DATABASE [db_name] MODIFY FILE ( NAME = [db_logic_name], FILENAME = '[new path]' )
2) Stop MSSQL server.
3) Move the file.
4) Restart MSSQL server.

That's all. Now you can check status by:

SELECT name, physical_name AS CurrentLocation, state_desc
FROM sys.master_files
WHERE database_id = DB_ID(N'[db_name]');

Monday, October 5, 2015

Underscore "_" is a wild card match character in MSSQL

Besides '%', underscore '_' is also a wild card match character in MSSQL. This can lead to some very subtle bug.

Say your table name has underscore in it, e.g., there are 2 tables my_Tablename and my_WeirdTablename. You find table using 'name like %_Tablename', then you will get both tables, instead of the first one. This leads to hidden bugs that are hard to identify.

To fix this issue, use this: 'name like %[_]tablename'. The '_' char is escaped by quoting it with brackets.

Blog Archive

Followers