Help: SQL Server

Sharing my knowlege about SQL Server Troubleshooting Skills

  • Blog Stats

    • 2,153,599 hits
  • Select GETDATE()

    June 2014
    M T W T F S S
     1
    2345678
    9101112131415
    16171819202122
    23242526272829
    30  

Archive for June, 2014

Help : How to get Product Key for SQL Server

Posted by blakhani on June 5, 2014


If you have come here by the search engines to get free product key for the SQL Server then you may want to stop right here and search to some other site. The idea of this post is to help those who are downloading (or downloaded) it from MSDN or volume licensing site or already have a installation media.

Below are some frequent questions which I have seen on forums.

  • Where can I get a product key from MSDN subscription for SQL Server 2012 edition upgrade?
  • How to Find SQL Server product key from an installed instance?
  • How to change SQL Server 2008 R2 product key change on production server?

Most of the question would be answered automatically once you understand how setup works.

When you go to “Subscriber Downloads” page search for SQL Server, and we can easily get the software. I have seen various post in the forum stating they they are seeing “No product key is required” as below.

image

This is very normal. From SQL 2008 onwards (2008 R2, 2012, 2014), the setup media comes with pre-pidded (except Evaluation and Express editions) Whenever we invoke setup.exe from that location, the PID would be picked automatically and filled in the screen. I have mentioned in one of my previous blog that PID would change the edition of SQL getting installed.

I have the media, how to get the PID?

When we run setup.exe from the media, the PID is picked from DefaultSetup.ini file located under Root\X86 or Root\x64 folder. This file is also used to make slipstream media (refer KB http://support.microsoft.com/kb/955392)

image

The file would look like below

;Configuration File
[Options]
PID="your pid value"

I don’t have that file. What’s wrong?

This would mean that your media is a evaluation media. You need to get full media.

Can I change the product key?

There are various product keys for same edition of SQL. You can use “edition upgrade” and change product key (assuming no edition change)

I have installed Evaluation Edition and want to upgrade to Enterprise Edition / Standard Edition

I have already written a blog on that. Can I Upgrade SQL Edition without reinstall?

Can I get PID for installed version?

The value is stored in registry in obfuscated format and there could be software to convert that. In good world, you may not need to use such software because if you have media, you know how to get product key.

  • Cheers,
  • Balmukund Lakhani
  • Twitter @blakhani
  • Author: SQL Server 2012 AlwaysOnPaperback, Kindle
  • Posted in Edition Upgrade, PID, Product Key | Tagged: , , | 9 Comments »

    SSMS Tip: How to drop multiple objects?

    Posted by blakhani on June 3, 2014


    Have you even been into situation where you have to drop many tables in a database? Or drop multiple databases? As a developer, you might right click on each table/database and choose “delete”. If you are equipped with little T-SQL knowledge, you might write a script to do the same. Do you know that management studio can do it?

    Let’s create multiple databases and learn the trick. I have used NEW_ID to get completely random name of databases.

    declare @number_of_databases int, @loop int
    select @number_of_databases = 10
    select @loop = 1
    declare @random_name varchar(40)
    declare @str nvarchar(100)
    
    while (@number_of_databases >= @loop)
    begin
    select @str = N'Create database [' + convert(varchar(100),NEWID())  +N']'
    exec sp_executesql @str
    set @loop=@loop+1
    end
    

    Once the script if executed, I have below in my management studio. Your databases would definitely be different.

    image

    Now, my task is – drop those databases which are created today. Without knowing the trick, one would get all databases name by query and then right click on database, choose delete. That would open a new window and we would choose “close existing connection..” and again hit OK. This has to be done 10 times. Now, here is my way of doing it.

    Click F7 on keyboard when SSMS is open. This would open “Object Explorer Details”. You can also use “View” in menu bar and choose “Object Explorer Details” item there. This would open a interface which is “details” on the object selected in “Object Explorer” . I would refer this as OED in later part of the blog. (OE of left and OED on right)

    image

    In OED, we have capability to sort the item based on various columns available. I want to sort databases them using date created. But by default that column is not shown. Let’s Right click on column header in OED and choose the column which we are interested. I have selected “Date Created”

    image

    Once that’s done, I can choose the position of the column by “dragging” the column name

    image

    Now, we can SORT as well by clicking on column name. I have sorted them by date created and as we can see all databases which I have created by script have listed next to each other. OED has capability the select multiple objects. This can be done by:

    • Use Shift key to choose all objects next to each other.
    • Use Ctrl key to choose multiple object using mouse

    Once desired objects are selected, use right click and choose delete. Simple. huh?

    image

    And once we choose delete, we get “Delete Objects” dialogue box which is similar to single delete.

    image

    We can choose the desired option and hit OK.

    Same operation would work for tables as well. We just need to choose proper node on “Object Explorer” and get details under “Object Explorer Details” – OED

    image

    Again, choose multiple tables in OED, right click and delete.

    I always felt that SQL Server Management Studio is one of “unexplored” and “underestimated” tool in SQL Server Product. Hope this blog has shown a little “hidden” gem of SSMS. If you know any such trick, please use comment section to share your knowledge.

  • Cheers,
  • Balmukund Lakhani
  • Twitter @blakhani
  • Author: SQL Server 2012 AlwaysOnPaperback, Kindle
  • Posted in SQL Server Management Studio, SSMS | Tagged: , , , , , , , | 1 Comment »