|
|
|
|
|
|
|
Welcome to SQL Server Examples
The examples on this portal will provide you with the building blocks necessary to quickly resolve different TSQL coding issues. You can browse the examples by using the Examples link on the main menu. You can also download all the examples on this site by clicking HERE.
Also available on this site is a SQL Server monitoring tool known as the SQL Server DBA Dashboard tool. This tool provides both high level and detailed reports to help monitor your SQL Server instances. With this tool you can quickly identify the resources used by specific TSQL statements and stored procedures.
The downloadable examples document and the dashboard tool are only available to registered user.
If you are a registered user and would like like to keep up to date on new examples and/or products/versions please subscribe to our newsletter by updating your profile.
This website is maintained by Gregory A. Larsen. If you would like to see your examples posted on this site, or have questions please Contact Us.
|
|
|
|
| Obtaining SQL Server Setup Information - Thursday, July 17, 2008This example obtain SQL Server instance setup information by using a number of select statements. read more ...
|
|
| First Day of the Quarter - Sunday, July 13, 2008This example calculates the first day of the quarter. read more ...
|
|
| Sequentially Number Records by Using Cursor - Wednesday, July 09, 2008This example sequentially numbers a record set by using a cursor. read more ...
|
|
| Sequentially Number Records by Altering Table - Saturday, July 05, 2008This example shows how to sequentially number records by altering table. read more ...
|
|
| Sequential Numbering Record Set Using Temp Table - Tuesday, July 01, 2008This example uses a temporary table to sequentially number a record set. read more ...
|
|
| Top 100 Stored Proceudures by Execution Count - Friday, June 27, 2008This example displays the top 100 stored procedures based on the number of times they have been executed. read more ...
|
|
| Top 100 Stored Procedures by IO Counts - Monday, June 23, 2008This example shows the top 100 stored procedures executed by IO counts. read more ...
|
|
| Displaying SQL Server Agent Job Statistics - Thursday, June 19, 2008This example displays SQL Server Agent Job statistics like, maximum duration, average duration and number of executions. read more ...
|
|
| Finding Status of SQL Server Agent Using T-SQL - Sunday, June 15, 2008This example allows you to determine the status of SQL Server Agent using T-SQL. read more ...
|
|
| Finding the Worst Performing T-SQL Statements - Tuesday, June 10, 2008This example is a stored procedure that will display the worst performing T-SQL statements on your server. It does this by using DMV's and DMF's. read more ...
|
|
| Calculate Running SubTotals - Sunday, June 08, 2008This example creates a running subtotals for each OrderDate. read more ...
|
|
| Calculate Running Total Using Subquery - Monday, June 02, 2008This example produces a running totals. It does this by using a subquery. read more ...
|
|
|
|
|
|
| SQL Server 2008 RC0 is available - Tuesday, July 01, 2008Microsoft has created RC0 for SQL Server 2008. If you have not yet download SQL Server 2008 to test it out now is the time. read more ...
|
|
| SQL Server 2005 SP3 - Thursday, April 24, 2008Are you tired of the Cumulative Updates from Microsoft? Microsoft has announced they are planning on creating a SP3 for SQL Server 2005. read more ...
|
|
| New SQL Server Monitor and Otimizer Tool - Friday, April 18, 2008Confio Software, the leader in Wait-Time database performance management tools, today announced the SQL Server version of the new Confio Igniter Suite PI for monitoring, managing and optimizing databases and the applications that depend on them read more ...
|
|
| New Visual Studio 2008 MCTS Exams - Monday, April 14, 2008
|
|
| SQL Server Reporting Services Tutorials, Links and Resources - Saturday, April 12, 2008SQL Server Reporting Services (part of SQL Server 2005) is a very useful toolset to add to your tool kit as a SharePoint Developer, Engineer, Administrator, user, etc. SharePoint Web parts and the good old report center can leverage integration with SSRS to solve many business reporting needs. Here are a few resources (not all) that you can use to bring you up to speed on using SSRS. read more ...
|
|
|
|
|
|
Most recent blog entries
|
 |
|
|
|
Free Training |
|
Greg
|
By greg on
7/9/2008 10:26 PM
|
|
|
|
Want some free SQL Server training? If so keep your eyes open for SQL Saturday events in your area. SQL Saturday is a mini-summit that uses the multiple presentation and track format. These sessions are presented by industry experts and peers that have a desire to sharing information related to SQL Server.
So far a number different SQL Saturday events have already been held, and more are being organized all the time. At the present time SQLSaturday event #5 and #6 are calling for speakers, and open for registration. Go to SQLSaturday.com to find out more about where these events are being held. If one is being held locally in your area and you have a passion for speaking consider submit a session abstract. If speaking isn’t your thing then at least register for the event to reserve your spot since seating at these events are limited.
|
 |
|
Comments (1)
|
More...
|
|
|
|
SQL Server 2008 Features by Edition |
|
Greg
|
By greg on
5/9/2008 7:12 AM
|
|
|
|
Over the last few months Microsoft has been having many different launch events worldwide for their 2008 products: Visual Studio 2008, Windows 2008, and SQL Server 2008. I had the opportunity to attend one of these launch events Being a SQL Server DBA I attended the Data track of their rollout. In this track they discuss all the new features that are being incorporated into SQL Server 2008. What this presentation missed was discussion related to the different editions available with SQL Server 2008, and which features where available by edition To me it seems like a lot of the cool new features all seem to be implemented in the Enterprise edition. But there are still a number of exciting new features in the other editions as well. Here are some links you can use to compare the features by edition.
Compare the Enterprise and Standard Edition:
|
 |
|
Comments (0)
|
More...
|
|
|
SQL Server Patch Management Methodology |
|
Greg
|
By greg on
4/24/2008 4:58 AM
|
|
|
As most of you probably already know Cummulative Update #7 for SQL Server 2005 was released on April 17th. (http://support.microsoft.com/kb/949095). Also Microsoft has now said they will be providing a Service Pack 3 sometime after SQL Server 2008 has been release to manafacture (http://blogs.technet.com/dataplatforminsider/archive/2008/04/15/sql-server-2005-sp3-coming-soon.aspx). So one way or another you should consider how you plan to patch your SQL Server 2005 machines.
As I see it there are three different patch management strategies you can take. The first option is every 8 weeks when a ...
|
 |
|
Comments (1)
|
More...
|
|
|
GIS Data Types in SQL Server 2008 |
|
Greg
|
By greg on
4/15/2008 6:17 PM
|
|
|
|
SQL Server 2005 has some new GIS data types. How many of you are GIS savvy? Well I’ll by the first one to admit that I don’t work with GIS data. But I am starting to look at SQL Server 2008 and trying to encourage our GIS guy to look at the new GIS data types within SQL Server.
Today the Redmond Magazine has an article where John Baleja, senior product manager at mapping software provider ESRI says “…will be easier integration with other applications, more security and possibly better performance.&rdquo ...
|
 |
|
Comments (0)
|
More...
|
|
|
SQL Server Networking |
|
Greg
|
By greg on
4/12/2008 11:34 AM
|
|
|
Did you think this post had something to do with the routers, switches and wires connecting SQL Server machines to the World Wide Web? If so you are wrong. This post has to do with my experience working one of the vendor booths at the “Heroes Happen Here” launch last week. For those of you that don’t know what the “Heroes Happen Here” launch is all about let me give you the scoop. These are events held all over the world , and this is where Microsoft is communicating to the IT community all the great things that about the new Visual Studio, Window Server and SQL Server 2008 versions have to offer. If you need more information about these events and want to find a launch near you check out this website: http://www.microsoft.com/heroeshappenhere/regi ...
|
 |
|
Comments (0)
|
More...
|
|
|
Performance Audit |
|
Greg
|
By greg on
4/8/2008 9:17 PM
|
|
|
|
How many of you do a Performance Audit of your SQL Server instances? I’ll have to admit I have never done a formal performance audit of our SQL Server instances. But to give myself some credit, back in 2007 I identified a number of DBA goals for 2008, and one of those was to developing a criteria and method of doing a performance audit. I’m going to venture to guess that most of you also have never done a performance audit as well.
Today Brad McGehee, the Directory of DBA Education from Red-Gate software came to the Olympia Area SQL Server User group, which I chair, and talked about performance auditing. His presentation was very well done and received by members of my user group. Brad talked about all the different things th ...
|
 |
|
Comments (0)
|
More...
|
|
|
SQL Server 2008 Certification |
|
Greg
|
By greg on
4/7/2008 8:46 PM
|
|
|
|
Last week there was a forum post about getting certified for SQL Server. The poster was asking about resources and how one should prepare for the MCDBA certification. The MCDBA certification is a SQL Server 2000 certification. At one point a number of years back it was the certification to have if you where a DBA, but now with SQL Server 2000 soon to be two versions back you probably should focus on one of SQL Server 2005 certifications, or wait for SQL Server 2008 certification to come out.
Certifications are a great way to get your foot in the door and show potential employers that you know something about the technology for whatever job you might be applying for. Even having an old certification is better than having no certification at all. So what should one do now if they want to get certified in SQL Server?
|
 |
|
Comments (0)
|
More...
|
|
|
Is T-SQL dead? |
|
Greg
|
By greg on
4/3/2008 9:23 PM
|
|
|
|
On Tuesday I went to the SQL Server 2008 launch in Seattle. Of course the launch was more than just SQL Server 2008, it also included Windows Server 2008 and Visual Studio 2008. So there was a lot of BUZZ about 2008 stuff going on.
I attended one of the presentations on Visual Studio 2008 that was talking about LINQ. LINQ stands for Language Integrated Query. In this presentation they talked about how programmers can now get SQL Data into a object model using something called “LINQ to SQL”. So I browsed the web for LINQ to SQL document and here is a blurb from a Microsoft document :
“In LINQ to SQL, the data model of a relational database is mapped to an object model expressed in the programming language of the developer.”
Now by looking at this statement I get the impression that Microsoft thinks developers don’t use T-SQL as a programming language. So I wonder if LINQ w ...
|
 |
|
Comments (0)
|
More...
|
|
|
|
 |
|
|
|
|
|
|
|
|