It one of the most common issue you will face when you will move/copy your database from one server to another server. You will have all finely setup SQL Server Logins and their related database users but when you copy or move your database those Server Logins will not get transferred automatically. Result is what we call Orphan Users, these database users are there in database but there is no login associated with it. In other words they are just useless and will create various issues related to authorization if an application or users are using it.
There are many cases when you may need to manually map SQL Server Logins with database users. For example it is possible that you have different logins created in SQL Server and you wanted to use these new logins with existing users Or you might even have same logins but since they are on different machines it is very likely that they will have different SIDs (Security Identifiers) Or simply some users has left an organization and you want to assign new user existing login (which I think is more easy by use of ROLES rather than directly assigning a user) Or wanted to have different user name then server login.
For all of these condition there is a system stored proc called “sp_change_users_login“ which can be used to manually assign logins to database users. I have created a simple demo to display the concept and process of mapping existing users to new logins.
If you have been looking for job in Database related field then you might be already familiar with this age old question (which I was asked in almost all interviews) is “What is difference between DELETE and TRUNCATE ?” And usually if you read on internet you will see that people answer it with just one line that,
When you use DELETE to delete records, information is stored in transaction log and hence it can be rolled back. And when you use TRUNCATE, no information is stored in log and so you can’t it rollback.
But technically it is wrong. I mean it is true that when you use TRUNCATE it doesn’t gets logged into transaction log, but it simply wrong to say that truncate will not let you rollback your operation. Code below can explain this operation,
This quick post is about changing default port in Apache. Say if you wanted to work with IIS and Apache both. Now, both web server uses port 80 and so you can’t have both of them at the same time. So one has to sacrifice it’s favorite port . In my case it was Apache not because I am MSFT technology user but just because I am working with Apache just as sort of self improvement project and most of the time I will
want have to work with IIS. So I need to change default port of Apache listen to some other number then 80, which is very simple process.
All you need to do is to locate “httpd.conf” file and look for section where it mentions about listening port. Something similar below,
I’ve been using Windows Servers provided by MSFT for free from past few years (not by downloading from Torrent sites by via DreamSpark program) ranging from 2003r2 to the latest one 2008r2. And almost all of them have one feature that really annoys me and that is “Shutdown Event Tracker”. I simply don’t understand that who would like to fill up why they want to restart. At first (when I was in school) I thought that may be sys admins do really enter details but when I begun working I found that it is rather annoying to them as well !! It is just beyond me that why would someone really want to use this feature !!
So this quick post is about how to disable this feature in Windows Server 2008 r2. But I think it applies same to other older versions (2008, 2003 r2) as well.
All you need is to run “gpedit.msc” using RUN. It will open up group policy editor window.
Last week I was working on something where I was required to write a delete query against few records in table. Now a days I am kind of habituated to use alias for tables whenever I write any query (mostly because of tool
I am we are using for SQL development, which don’t have intellisence if alias is not being used for table name !!) and in other case it was join between two tables was required to delete records. So as with other query, I wrote my simple delete query with alias … and found that when you use alias delete statement is a bit different !!! Below is how I reproduced same issue in my laptop. (Note: Query is using a test table I created using good ol’ AdventureWorks sample database)
-- Delete from table using Alias Delete from TableFoo TF where City='Renton' go
But parsing this query gave me following error
Msg 102, Level 15, State 1, Line 1
Incorrect syntax near ‘TF’.
If you are working with Silverlight and don’t have good “designer’s eye”, or planning to begin new project or simply want to play around with Silverlight then you might want to try these Silverlight navigation themes from Microsoft. Currently there are four standard themes are available for download from MSFT Site JetPack, Accent Color, Windows 7 and Cosmopolitan, they are highly customizable and free for any use. Basically they have all styles defined for all standard controls and Silverlight Toolkit (which is a must requirement for these themes to work)
Installing these themes to VS 2010 is way too easy. All you need to do is just execute VSIX files included in the package and you are all set. But if you want to use these themes in Blend 4, then it is a bit tricky process. First you need to extract those themes and then copy them to %ProgramFiles%\Microsoft Expression\Blend 4\ProjectTemplates\en\CSharp\Silverlight folder. But if you are using x64 bit OS then this path will be %ProgramFiles (x86)%\Microsoft Expression\Blend 4\ProjectTemplates\en\CSharp\Silverlight for you !!! And wait there is more (, yes me too watch late night TV commercials … ) apparently all of these files have same structure and same template file names so you can’t just copy all of these themes into one single location, since it will overwrite each other and in the end you will be left with only once theme that you copied last !! And there is no explanation of this in official read me document or any where on the net.
Just now due to my “experiments” OS and other stuff, I had to restore system image of my OS installation drive (it is more easy to restore image then formatting drives and reinstalling everything ). But unfortunately the image I took was a bit newer (or say more older) so it had only essential software installed on it. So I was installing Visual Studio 2010 all again, mean while I also got SP1 for VS 2010 so I updated VS 2010 with SP1 as well.
As my work requires me to work with Silverlight, I was also required to install Silverlight Tools to work with. But with surprise when I tried to download and install Silverlight tools from MSDN, I got really weird error message.
Visual Studio 2010 or Visual Web Developer Express 2010 or Visual Phone Developer Express 2010 that matches the language version of Silverlight Tools 4 must be installed before installation of Silverlight Tools can continue.