


When you are writing SQL code, very often you run parts in isolation by commenting out what you don't need and uncommenting portion that is to be executed. A very simple approach of writing SQL comments coupled with SSMS(studio) shortcuts for commenting/uncommenting sections of code can help you do...
Posted on 6 January 2014 | 3:01 pm
Read postJust like sp_MSforeachtable you also have a stored procedure which runs for each DB. It is sp_MSforeachdb SYNTAX EXEC @RETURN_VALUE=sp_MSforeachdb @command1, @replacechar, @command2, @command3, @precommand, @postcommand where: @RETURN_VALUE - the return value which will be set by "sp_MSforeachtable"...
Posted on 2 January 2014 | 3:06 pm
Read postMany times we ought to search if a table exist in DB. At those times we typically search the object explorer and do a manual search. This is OK if we have like 1-50 tables; but for huge databases it is best to run a query and find the result.Below are 3 queries which use different methods to find th...
Posted on 2 January 2014 | 11:11 am
Read post