Real time savers in SQL Server 2008 & a personal advice :)

Its disheartening to see that we developers are eventhough unwillingly ready to work for hours in the night but not ready to learn the things which can actually save lots of time and allowing ourselves to enjoy other parts of life too. I am not sure who to blame for this - developers or leads like us who has the responsibility to get the work done, keep the project core - the product, the solution, the code of software we are developing, of high quality, keep informed the developers the innovative ways, new developments, new tools using which they can save time and write code which would be useful for future as well as efficient, thus giving high quality end product. But in any case we all should own collective responsibility for it and everybody should work to improve the situation.

Take some time out to see what's happening in the programming world, learn new technologies and get certified,  learn better programming practices, read great programming books, motivate upgradaton in the technologies, become MVC :)  , share with everybody, and apply it on all the work you do. With my personal experience I can say that companies always supports the new ideas but you need to work to convince its fruitfulness. Let's take a break, ponder, and start doing something about it!
Anyway, let me now share with you couple of time saving features SQL 2008 has in addition to  in-built intellisense and others.  Using T-sql debugging shipped with SQL server 2008 is very simple . Also another time saving feature is searching objects in the database.

T-SQL Debugger
In SQL Server 2000, there was debugging a routine in Query Analyzer, as a debugger tool was available with it. Starting with SQL Server 2005, Query Analyzer and Enterprise Manager had been clubbed together as SQL Server Management Studio (SSMS). Though this single interface has simplified working with SQL Server, one major drawback was, it does not allow you to debug a routine from there. For that purpose you needed Visual Studio (Enterprise and Professional) edition installed, on your development machine, which allowed you to debug a routine. But very few of the people cared to use this and rather resorted to methods like putting "print @parameter" in queries, the shortcut method in short run :). And due to this manyatimes I have seen developers forgetting it and allowing print to go on production.

Debugging capability in SSMS was a long sought feature by users and finally the Microsoft SQL Server team decided to provide this feature in SQL Server 2008. With this feature you can navigate through your code, line by line, watch the current state of variables in the program, an output window where you can observe what the code is doing, error windows, the ability to navigate backward and forward through each line, observe system objects such as the call stack and threads, not only this you can even place "breakpoints" and then tell the debugger to run the code up to that point and then stop.
Debugging SQL server is in steps:
  • Right click Procedure>Script stored procedure as>Execute To>New Query Window
  • In the opened window, put the parameters you want to pass.
  • Set a breakpoint on exec
  • Press Alt + F5 to start the debugging and here you go debugging of the procedure starts
  • Go on pressing the F11 and it will step into each line of the procedures, for which you can see the values, quickwatch everything.

Object Search
At the top of the Object Explorer Details (OED) panel, which you can show by pressing F7 in SQL Server Management Studio, you'll find a "Search" text box. If you want to find an object in a particular database, just click on any database object in the Object Explorer (OE). Then enter the name of the object you want to find. If you want to search all databases, click on the "Databases" node in OE and then enter the text string.

If you want to find an exact match on an object name, just enter the text you want (it isn't case-sensitive unless your database is). If you want a partial match, then use the standard T-SQL wildcards. For instance, Account% finds all objects that start with "Account". %Account% finds all of the objects that have "Buck" in the name. Once you find the object, you can right-click them to perform certain actions on them. If you want the full range of right-click options, then right-click the object and select "Synchronize" to find the object in OE, where you'll have all of the options.

This is it for now.Your valuable feedbacks please :) !


No comments: