Search 
Wednesday, September 08, 2010 ..:: Home ::.. Register  Login
  

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.


  
 Recent Examples
Getting Output To a File without Column Headings - Saturday, November 22, 2008
This examples shows you how you how to get output from a T-SQL statement into a file without it having column headings.
 read more ...

Obtaining SQL Server Setup Information - Thursday, July 17, 2008
This example obtain SQL Server instance setup information by using a number of select statements.
 read more ...

First Day of the Quarter - Sunday, July 13, 2008
This example calculates the first day of the quarter.
 read more ...

Sequentially Number Records by Using Cursor - Wednesday, July 09, 2008
This example sequentially numbers a record set by using a cursor.
 read more ...

Sequentially Number Records by Altering Table - Saturday, July 05, 2008
This example shows how to sequentially number records by altering table.
 read more ...

Sequential Numbering Record Set Using Temp Table - Tuesday, July 01, 2008
This example uses a temporary table to sequentially number a record set.
 read more ...

Top 100 Stored Proceudures by Execution Count - Friday, June 27, 2008
This 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, 2008
This example shows the top 100 stored procedures executed by IO counts.
 read more ...

Displaying SQL Server Agent Job Statistics - Thursday, June 19, 2008
This 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, 2008
This 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, 2008
This 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, 2008
This example creates a running subtotals for each OrderDate.
 read more ...

Calculate Running Total Using Subquery - Monday, June 02, 2008
This example produces a running totals. It does this by using a subquery.
 read more ...


  
 SQL Server News
SQL Server 2008 RC0 is available - Tuesday, July 01, 2008
Microsoft 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, 2008
Are 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, 2008
Confio 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
Three Visual Studio 2008 MCTS came out today (see below). Passing one of these exams along with the Exam 70-536 TS: .NET Framework, Application Development Foundation are need to get certified.

Exam 70-502 TS: .NET Framework 3.5, Windows Presentation Foundation Application Development
http://www.microsoft.com/learning/exams/70-502.mspx

Exam 70-503 TS: .NET Framework 3.5, Windows Communication Foundation Application Development
http/www.microsoft.com/learning/exams/70-503.mspx

Exam 70-504 TS: .NET Framework 3.5, Windows Workflow Foundation Application Development
http://www.microsoft.com/learning/exams/70-504.mspx
 

SQL Server Reporting Services Tutorials, Links and Resources - Saturday, April 12, 2008
SQL 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 ...


  
 SQL Server Networking Minimize
Location: BlogsGreg    
Posted by: greg 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/register/default.mspx
This blog entry has nothing do with the new 2008 products, but has more to do with communicating my experience working the PASS booth at the Seattle “Heroes Happen Here” launch. For those of you that don’t know about PASS, it stands for Professional Association for SQL Server. It is a worldwide community dedicated to Microsoft SQL Server professionals.   PASS holds a summit in Europe and the United States once a year.   Each of these summit events brings together thousands of SQL Server professionals to discuss SQL Server issues, topics, and events. These summit events are held over a number of days and provide some of the best training opportunities, from SQL Server gurus and normal SQL Server DBA/developer types like you.    The next summit will be held in Seattle on November 17-22 2008. If you are interested in knowing more about PASS or signing up for the summit at a limited time reduced rate check out the PASS website here: http://sqlpass.org
Not only does PASS have two annual summits on both sides of the Atlantic Ocean but the PASS community also consists of over 80 local PASS user group chapters. These local user groups are scattered all over the globe. Each local user group is run a little different but they all have one thing in common, they hold routine local user group meetings to discuss SQL Server related topics. These meetings typical have one or two SQL Server related presentations per meeting. These local PASS chapter meetings are a great place to learn more about SQL Server and/or share your experience with other SQL Server types in your region of the world. 
Ok, now back to may PASS booth experience at the Seattle launch. While at the PASS booth hundreds of people stopped by asking what PASS was all about. This was not really surprising in itself because many people that use Visual Studio and/or Windows Server don’t all have SQL Server in their environment.   But what surprised me the most was the number of SQL Server individuals that never knew there was a PASS organization, much less that there were local PASS user group chapters right in their own backyard.  I’m a local PASS chapter leader in Olympia, Washington so working the PASS both allowed me a great opportunity tospread the word about my PASS local chapter, the PASS organization, as well as time to talk with developers and other DBAs about their SQL Server Experience.   
If you are reading this post you probably have a vested interest in SQL Server and learning more about it. Do you know the location of the closest PASS chapter user group is in your area? These local PASS chapter groups are a great opportunity to network with other SQL Server geeks, and get some great training at the same time. Did I mention that most of these user group opportunities are free.  So if you don’t already know where the nearest PASS chapter is in your part of the World then you should check out the “Chapters” link on the PASS website above.    
If you’d like to know more about local PASS chapters, and can’t find out everything you need to know about it on the PASS website, drop me a note at gregalarsen@sqlpass.org . I’ll do my best to answer your questions, and if I can’t answer them I’ll find someone that can. 
Are you a member of PASS? Do you belong to a local PASS chapter? If not what is stopping you? Join the PASS family now and start receiving great SQL Server training and information.
 
Happy PASS Networking,
Greg Larsen, MCITP
http://sqlserverexamples.com 
Permalink |  Trackback

  
SQL Tools Heaven
Exceptional DBA
SQL Compare
Copyright 2007, 2008 by SQLServerExamples.com   Terms Of Use  Privacy Statement