Stored-Procedures

Tag: stored-procedures

Use ChatGPT to See Multiple Perspectives: An Example With ORMs and Database Code

Use ChatGPT to See Multiple Perspectives: An Example With ORMs and Database Code

There’s a lot of hype, concern, and fear regarding generative AI lately. Tools like ChatGPT are so good at generating groups of words that it feels like magic– however, generative AI doesn’t have the ability to understand or verify the language it generates. For example, it’s been used to write news stories for CNET – but sometimes included facts that are just plain wrong.

One positive use case of a generative AI tool like ChatGPT is to ask it to make a case for different perspectives than your own, and use this as a starting point to broaden your understanding – with the knowledge that we need to verify everything ChatGPT tells us. As an example, let’s chat to ChatGPT about Object Relational Mapping tools (ORMs).

Continue reading

Gotchas with Deferred Name Resolution in SQL Server: Stored Procedures, Synonyms, Views, and Functions

Gotchas with Deferred Name Resolution in SQL Server: Stored Procedures, Synonyms, Views, and Functions

Have you ever tried to create an object in SQL Server, but it failed due to a missing table, column, or other dependency? If so, you’ve hit a case where SQL Server doesn’t offer ‘deferred name resolution’.

Continue reading

Take the SQLChallenge: Tuning a Stored Procedure

Take the SQLChallenge: Tuning a Stored Procedure

I’ve just published a new SQLChallenge course, and I think it’s one of the best ones yet.

Your mission is to:

  1. Identify which statement is slowing down our stored procedure the most
  2. Tune the code to speed it up. You can change the query that is slow as well as anything else in the procedure that will help you make that statement faster.

In the solution videos, I’ll step through multiple strategies to figure out which statement in the procedure is slowing it down the most – because in real life, you need to have a whole bag of tricks in different situations. 

Continue reading

Using RETURN in Transact SQL: Quiz Results

Using RETURN in Transact SQL: Quiz Results

RETURN is a “control of flow” language keyword in Transact-SQL. It’s very useful for managing when code does – and does NOT – get executed in procedural code, and it can also be used to communicate the status from procedural code.

But not everyone knows how to use RETURN, and learning about it can be awkward because of some quirks of SQL Server Management Studio. It is well worth taking the time to get used to it, though!

Continue reading

What is Deferred Name Resolution, and How Can It Go Wrong?

What is Deferred Name Resolution, and How Can It Go Wrong?

I got a question recently about why a particular bit of code was failing when running.

My first thought: oh, that’s probably related to… whatsitcalled.

Continue reading