Skip to content

✏️ Earn 6 months of Premium for your first approved article. Register.

WOW! SQL queries are case insensitive
974 views

WOW! SQL queries are case insensitive

View favourites

I recently discovered that when querying data views, case sensitivity in column names doesn’t make a difference; it consistently picks up the column when named correctly. Let’s explore where else column case sensitivity doesn’t play a significant role.

First let’s create a data extension with some columns so we can test following in Query studio, Automation Studio and in AMPScript.

We will attempt to execute the following query. As you can observe, I’ve referenced “FirstName” differently in the WHERE clause.

Select fIrStnAme,LaStName from mArCel_TeSts where FiRstnAmE = 'Marcel'

Query studio

Column and even table names can be in random case, and the system still accurately retrieves the correct data.

Automation Studio

I was initially skeptical about running the same query in the automation studio. However, when the query was successfully validated, I had no doubt that this case insensitivity is indeed functioning as expected.

Once we had provided the WHERE clause and all the required columns, the automation worked seamlessly and efficiently moved the data to another data extension.

AMPScript and SSJS

I had the most doubts about AMPScript and SSHS, but to my surprise, it works just as well as in other cases

%%[
SET @name = LOOKUP("marcel_tests","EmAiLADdresS","EmaIlAddResS","email@martechnotes.com")
]%%
<pre>
%%=v(@name)=%%
</pre>
<script runat="server">
     var name2 = Platform.Function.Lookup("maRcel_Tests","EmAiLAddreSs","EMaIlADDreSS","email@martechnotes.com");
  Platform.Response.Write(name2);
</script>

Oh hi there 👋
I have a SSJS skill for you.

Sign up now to get an SSJS skill that can be used with your AI companion

We don’t spam! Read our privacy policy for more info.

Share With Others

The author
Marcel Szimonisz Platinum

Marcel Szimonisz

Marketing Automation Consultant

I specialize in solving marketing technology challenges, automating processes, and turning ideas into practical solutions with Salesforce Marketing Cloud and Adobe Campaign. Through MarTechNotes, I share technical guides and insights that make complex topics easier to understand

Latest badges
Weekend Regular Weekend Regular Profile Complete Profile Complete Simple Start Simple Start 5 Day Streak 5 Day Streak First Comment First Comment

Your email address will not be published. Required fields are marked *

Get exclusive tips, scripts and news

Choose your topics

We don’t spam! Read our privacy policy for more info.

Similar posts

Add to this article

Share your experience

Your contribution

Article history

What changed