Portrait in T-SQL

So, uh, you can, like, draw me in SSMS.

Humor
6 Comments
Adrian Sullivan and Michael J. Swart have way too much time on their hands, because Adrian just posted this T-SQL gist, which draws … me: It uses the spatial results feature in SSMS. My mind is blown. I’m totally going to use that in a demo. Thanks, Adrian! I’m already envisioning all kinds of crazy…
Read More

Pop Quiz: SQL 2000 Bug or SQL 2017 Bug?

2002: Me and Bailey, mom’s Great Dane When I was thinking about this site’s 17th birthday, I started wondering: back in 2002, what bug might I have been working with in SQL Server? I started reading back to the list of bugs fixed in SQL Server 2000 Service Pack 1, and it hit me…these bugs…
Read More

One Hundred Percent CPU

Raise Your Hand If You’ve ever wanted to play a prank on your co-workers, but just didn’t have a any ideas that didn’t involve exploding Hot Pockets. Now you have something even less safe than molten cheese squirts! A stored procedure that pushes CPUs to 100%. All of’em. Transact-SQL CREATE OR ALTER PROCEDURE dbo._keep_it_100 AS…
Read More

300 Blogs And Running

Why Bother Blogging? I blog primarily because there’s a Certain Kind of Person that irks me to no end. The kind of person who: Withholds information (you wouldn’t understand anyway) Mocks people for not knowing what they know (oh, you silly things) Uses the people they mock to validate their necessity (you’d be lost without…
Read More

Stupid T-SQL Tricks

Presented without comment: Transact-SQL CREATE TABLE dbo.[FROM] ([SELECT] INT, [WHERE] INT, [LIKE] INT); GO SELECT [SELECT] FROM [FROM] WHERE [WHERE] LIKE [LIKE]; GO 1234 CREATE TABLE dbo.[FROM] ([SELECT] INT, [WHERE] INT, [LIKE] INT);GOSELECT [SELECT] FROM [FROM] WHERE [WHERE] LIKE [LIKE];GO Next up, can you break up a query with spaces? Yep: Transact-SQL SELECT * FROM…
Read More

Stuff People Tell Me Is The Default

Playing The Odds Assuming that life carries on as usual for a couple more weeks, I’ll have been a consultant here for three years. In that time, I’ve had some really interesting conversations with people, mostly about why things are the way they are on their servers. My favorite response is “isn’t that the default?”,…
Read More

How To Break SQL Server’s XML Data Collection

Humor
Oh, XML When we first met, it was about 2011. I had to load files full of you into a table. It wasn’t so bad. Seriously. You were well-formed, and didn’t change from file to file. Even using SQL Server 2005, I could take you. Later on, we got really close when I awkwardly started…
Read More

Let’s Give The Optimizer A Name

Clunky As my favorite monkey likes to say, the hardest things do with computers are: 1. Naming things 4. Asynchronous processing 2. Cache invalidation 5. Off by one errors Things are tough for Microsoft, too. Take “the optimizer” for instance. It’s based on something called the Cascades Framework. No one wants to say “Cascades Framework”,…
Read More

How to Throttle Logins to SQL Server

So, uh, you can use WAITFOR in a logon trigger: Transact-SQL CREATE OR ALTER TRIGGER SorryNorm ON ALL SERVER FOR LOGON AS BEGIN IF ORIGINAL_LOGIN()= 'NormTheNewGuy' WAITFOR DELAY '00:00:15'; END; GO 123456 CREATE OR ALTER TRIGGER SorryNorm ON ALL SERVER FOR LOGON ASBEGINIF ORIGINAL_LOGIN()= 'NormTheNewGuy'    WAITFOR DELAY '00:00:15';END;GO You probably don’t want it to be TOO…
Read More
Brent Ozar reading

Things I Have Not Heard Recently

“No, don’t bother the DBA. It’s probably not a database problem.” “But it says right here that it worked on my machine.” “Solid state storage sure is overrated.” “Thank God for auto-shrink, really saved the day again.” “We’re not picky – you can apply updates whenever you want, whenever’s convenient.” “The VM admin said to…
Read More

French makes everything sound so sexy.

Even error messages: Transact-SQL SELECT * FROM sys.messages WHERE language_id = 1036; 12 SELECT * FROM sys.messagesWHERE language_id = 1036; Produces: Talk dirty reads to me These sound better than anything I would ever write in a romantic letter: “SQL Server a détecté une corruption de mémoire matérielle dans la base de données « %1! », à l’ID…
Read More

Do Variables Exist?

I know, I know I swore I’d never talk about variables again. Then I ran into some funny business. Maybe it was quite as funny as the Temp Table Ghosts, but hey. What’s as funny as temp tables? It’s in your heaaaaaaaad If I run this, what do you think will come back? Transact-SQL IF…
Read More
Menu
{"cart_token":"","hash":"","cart_data":""}