Last time, we learned about CHARINDEX and all of the fun that it can do to make dealing with strings within strings a bit easier. This time, I want to talk about another function that does kind of the same thing but slightly differently. The function I’m talking about is PATINDEX. When you think about…… Continue reading Looking for Strings A Different Way
Tag: SQLQuestions
Matching Strings within One Big String
Continuing on with our series from last time – see here if you somehow missed it – let’s have some more fun with the different functions we can use with strings. This time, let’s focus on looking for different items we can use to find a string within a string. One of my favorite functions…… Continue reading Matching Strings within One Big String
Making Letters Do What Want
In our databases, we’ll find all kinds of string data. Sometimes, you’ll find a reason to work with alphanumeric data individually in different ways. Let’s go through an example that I worked with recently that is not quite the Norm. Norm! The business unit I work with wanted to categorize a specific group of people…… Continue reading Making Letters Do What Want
Making Numbers Look Better
The last time we were together, we discussed Making Better Numbers. Hopefully, you took a few minutes to review some of the examples I provided, figure out which ones do and do not make sense to you, and try to figure out some examples on your own. If not, try doing that before reading any…… Continue reading Making Numbers Look Better
Making Better Numbers
In our last post, we discussed fixing dates so that they’re more of what the users expect. In this post, I want to talk about changing numbers. First off, it’s actually a very common thing to change a number from one type to another. For example, I’m often asked to change a decimal into an…… Continue reading Making Better Numbers
Making A Better Date
In the last few posts, we’ve discussed different ways of “prettifying” – yes, a very technical word – dates. And no, we’re not talking about the kind you can eat or go on. Healthy Dates Nope, we’re talking about this kind of date: https://www.youtube.com/watch?v=cx5jt0zrJ9E Let’s say you’re busy coding along and you come to the…… Continue reading Making A Better Date
Prettifying A Whole Mess of Dates
In our last time together, we were talking about Doing more when trying to Convert. One of the many things I mentioned was using the CONVERT function to change a date to always look a particular way – for example, MM-DD-YYYY or DD/MM/YYYY. Since the CONVERT function requires you to either look up each time…… Continue reading Prettifying A Whole Mess of Dates
Doing more when trying to Convert
The last time we met, we discussed the glorious try_convert function and how it can save us from “not-so-datey” dates. Most of the time, at least in a business setting, we don’t want to display NULLs to our users, so in many cases, we’re asked to put a placeholder if there is a NULL. We…… Continue reading Doing more when trying to Convert
Telling data to act like other data
When messing with data, sometimes you want to change how SQL Server sees the data. For that, you would want to use the CONVERT command. There are many great reasons to do this and thankfully some of our datasets have some great possibilities that you can work with. For example, after looking at the Nirvana…… Continue reading Telling data to act like other data
The End of the TOP
After dealing with TOP and ROWCOUNT in SQL Server, there is one more way of getting a limited amount of data from a query that you should be aware of – OFFSET/FETCH. It can be a little bit more difficult to set up and work with but if you’re in need of the data a…… Continue reading The End of the TOP