Removing Objects Is Not So Simple

When you’re working between SQL Server and Snowflake, there can be a lot of crossover that may make you forget what system you’re working in. Sometimes it’s close, but not close enough.

Today, let’s go over something that should be rather simple – removing old objects that we shouldn’t need any longer.

In SQL Server, you would remove a table like this:

As you can see, I created a small table – just to drop it.

In Snowflake, you would remove a table like this:

Looks about as close to the same as we’re going to get.

Now, let’s look at procedures.

With SQL Server, I can create a simple stored procedure and remove it quickly.

Like before, it’s gone by the time it is in the system.

Now, over to Snowflake.

Even the simple procedures are a little bit more. I created a JavaScript procedure because it is more intuitive to me. All it does is return how many rows are in the temp table I created above. Yes, that’s one way to check your error handling…

And when I drop the procedure, I get an error.

Not quite as simple as we thought…

After much consternation and thought, dropping a javascript procedure in Snowflake isn’t all that hard…

Notice that the difference is the () at the end of the procedure name. Is it just enough to mess you up every time you need to drop a procedure in Snowflake?

So with that my friends, we find ourselves at the end of another of our segments of time together. Hopefully, you will remember to drop your procedures in Snowflake correctly next time – or at least remember where to refer back to if it fails…

Until next time!

1 comment

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.