There is some controversy about using cursors in TSQL. Overall, I believe they tend to tie up resources and are seen as bad. So how do you get around using them? Here’s how.
Programming
This short block of PHP code takes a SQL script and removes the “dash-dash” and “/**/” comments from it. Of course, many languages, including PHP itself, use the “/**/” comment style so this could apply to PHP scripts, as well.
(If you want to AVOID cursors, see: TSQL – Loop Through Result Set WITHOUT Cursors) This is the basic query text to use whenever you need to loop through a result set in SQL Server using TSQL. In this example we are getting every database name and printing it out.
Sometimes, as a DBA, you will have to copy a database role to another instance, such as when you have to move something from development to testing or production. Recently, I discovered that using the SSMS “script as” option doesn’t help very much at all. It simply generates a statement...
Upon trying to create a trace template in SQL Server Profiler, I was able to name the trace but there were no events to choose from in the “Events Selection” tab, even when the “Show All Events” box was checked. If I clicked the “Column Filters” button the entire Profiler...
Source of info: http://www.mattbutton.com/2011/06/01/sql-profiler-templates-missing/ Upon trying to create a trace template in SQL Server Profiler, I was able to name the trace but there were no events to choose from in the “Events Selection” tab, even when the “Show All Events” box was checked. If I clicked the “Column Filters” button...
Ideally, when setting up a data-driven PHP site, you should have your configuration and database connection code separate from your code that generates content. What I want to display is a simple way to keep things separate and simple to work with. I use a config/index/data file structure. There are...
Within a Stored Procedure, you may want the results of a particular query emailed to you, but only if there is a result. In other words, I don’t want to be notified when the result set size is 0.
This trick is for SSMS users who like the MDI (window) environment. If you’ve noticed that new windows open with the instance connection hidden, then read on. I have your fix! Just open a query window, minimize it, and leave it there. After that, new windows will open at the...
This still works but the UPDATE below is better The solution to WordPress not recognizing line breaks is to tweak your source code. You will need a way to edit the HTML on your site. Go to wp-includes -> post-template.php Search for “function the_content“. At the end of that function...