Reading Time: 2 minutesIt is absolutely possible to create indexes within a table variable in Microsoft SQL Server. The key is to add the indexes as part of the table variable definition Take a look at this regular table definition (which does not have any indexes placed on it yet): CREATE TABLE Books Continue Reading
Stored Procedures
Default Values in Stored Procedure Parameters: Do you know this rule?
Reading Time: 4 minutesIt is very easy to set up a default value for an input parameter in a stored procedure. When we establish a default value for an input parameter, it becomes optional to provide a value for that parameter when calling the procedure. In that event, the value used for the Continue Reading
SQL Server WAITFOR DELAY: Explained
Reading Time: < 1 minuteThe WAITFOR DELAY system function is the best tool we have in Microsoft SQL Server to introduce a pause in our SQL code. The syntax is extremely simple. We just run the WAITFOR DELAY statement on its own, like this: WAITFOR DELAY ’00:00:10′ You can see how in single quotes, Continue Reading
SQL Server Functions VS Stored Procedures: What’s the difference?
Reading Time: 6 minutesTwo of the most helpful objects you can create in Microsoft SQL Server are user-defined functions and stored procedures. If you are just starting out with SQL Server, you might wonder “What’s the difference?“. In this very brief tutorial, we’ll discuss the difference between SQL Server functions and stored procedures Continue Reading
Dynamic SQL: Explained for Beginners
Reading Time: 6 minutesThere may be times when you need to write a query and you need to make certain parts of that query dynamic, meaning the query might not be exactly the same every time you run it. SQL Server has a great tool we can use to create these dynamic queries. Continue Reading
SQL Server Temp Tables: A How-To Guide for Beginners
Reading Time: 7 minutesSQL Server temp tables are very useful tools available to us when it comes to querying and developing SQL Server databases. Temp tables offer a very easy way to create a table for a singular purpose and then remove that table when we are finished with it. In this very brief Continue Reading
How to Find Text in a SQL Server Stored Procedure: Just run this one query!
Reading Time: 4 minutesThere might be times when you simply need to search through the objects in a SQL Server database for a specific word or text. It would be a very tedious task to open each stored procedure, function, View, etc. and look through each to see if it references the text Continue Reading
What does “SET NOCOUNT ON” do in SQL Server? Explained!
Reading Time: 5 minutesMaybe you’ve been working with SQL Server for a while and have seen “SET NOCOUNT ON” here and there, but you aren’t really sure what it does. It’s usually seen within stored procedures, but it can be used anywhere. In this very brief tutorial, we’ll discuss what the SET NOCOUNT Continue Reading
Stored Procedure Output Parameters: A Guide for Beginners
Reading Time: 3 minutesStored procedures are some of the most complex objects we have available to us in Microsoft SQL Server. There are many tips and tricks you need to know when creating and using them in your databases. In this very brief tutorial, we’ll talk about one of the more confusing things Continue Reading
Don’t make this mistake when calling your SQL Stored Procedures!
Reading Time: 3 minutesStored Procedures are complicated beasts in Microsoft SQL Server. There are many quirks you should be aware of when creating and calling them. In this very brief tutorial, we’ll talk about one of those wacky rules. Take a look at the following Customers and ContactInfo tables: We have a stored Continue Reading