Article Detail
Vibe-Coding: Cautionary Tale 🚀📚🧠
A T-SQL Sleep Procedure Experiment
Introduction 🌱💻🕰️
In our laundry list of data-engineering tasks, sometimes we hit a little utility need—“just write a simple procedure that sleeps for a given time.” I decided to apply the current hype-flavored methodology known as vibe coding—letting an AI assistant generate the code, then reviewing and cleaning it. Spoiler: I learned a lot. What follows is a step-by-step write-up of what I asked, what I got, why it mattered—and what the bigger lessons are for data-engineering teams.
---
Step 1 🤖
Prompt:
create a t-sql procedure that sleeps for the specified
duration… use this signature:
util.sleep(@hours int = 0,
@minutes int = 0,
@seconds int = 0)
Response:
CREATE PROCEDURE util.sleep(
@hours INT = 0,
@minutes INT = 0,
@seconds INT = 0
) AS
BEGIN
SET NOCOUNT ON;
DECLARE @totalMilliseconds INT;
-- Convert the total time to milliseconds
SET @totalMilliseconds =
ISNULL(@hours, 0) * 3600000
+ ISNULL(@minutes, 0) * 60000
+ ISNULL(@seconds, 0) * 1000;
-- Use WAITFOR DELAY with a dynamic time string
DECLARE @delayTime VARCHAR(12);
SET @delayTime =
RIGHT('0' + CAST(@hours AS VARCHAR), 2) + ':'
+ RIGHT('0' + CAST(@minutes AS VARCHAR), 2) + ':'
+ RIGHT('0' + CAST(@seconds AS VARCHAR), 2);
WAITFOR DELAY @delayTime;
END;
Analysis: 🧠🪄📈 The AI quickly delivered a scaffold, but there were remnants of unused logic—@totalMilliseconds was declared and calculated but never used. That kind of leftover code is more than cosmetic; it introduces confusion for future maintainers. Whether you revisit it in a year or a teammate sees it tomorrow, someone will waste time wondering if it matters. The first vibe-coded draft already showed the tension between speed and clarity.
---
Step 2 💬
Prompt:
What is the purpose in calculating @totalMilliseconds?
Response:
The calculation of @totalMilliseconds is not necessary for WAITFOR DELAY. It was leftover from an alternative approach. You can safely remove it.
Analysis: 🧩🧠⚙️ Here the AI admits its mistake—a leftover line of thought that doesn’t belong. Advocates of vibe coding often claim the AI knows best practices, yet others say to treat it like an intern. Which is it? Experienced developers spot dead code quickly, but those learning through vibe coding might not. Step 2 reveals the danger of overtrusting the vibe: even simple logic can slip through unexamined.
---
Step 3 🧮
Prompt:
OK, but what happens if I pass in 90 seconds or 32 hours?
Response:
WAITFOR DELAY supports a maximum of 23 hours, 59 minutes, 59 seconds. It does not normalize inputs. Invalid formats like ‘00:00:90’ or ‘32:00:00’ will throw errors. Recommend normalizing and capping inputs.
Analysis: 🧠⚙️🧭 This was progress. The AI identified a real limitation of T-SQL’s WAITFOR DELAY. However, its fix was rigid—rejecting anything beyond 24 hours. In many use cases, a parameterized threshold or multi-day handling would be better. The AI was technically correct, but not contextually thoughtful. Human judgment remains key.
---
Step 4 🧰
Prompt:
Yes. Rewrite with normalization logic and validation.
Response:
CREATE PROCEDURE util.sleep(
@hours INT = 0,
@minutes INT = 0,
@seconds INT = 0
) AS
BEGIN
SET NOCOUNT ON;
DECLARE @totalSeconds INT;
SET @totalSeconds =
ISNULL(@hours, 0) * 3600
+ ISNULL(@minutes, 0) * 60
+ ISNULL(@seconds, 0);
IF @totalSeconds > 86399
BEGIN
RAISERROR('Sleep duration exceeds 23:59:59.', 16, 1);
RETURN;
END
DECLARE @hh INT = @totalSeconds / 3600;
DECLARE @mm INT = (@totalSeconds % 3600) / 60;
DECLARE @ss INT = @totalSeconds % 60;
DECLARE @delayTime VARCHAR(8);
SET @delayTime =
RIGHT('0' + CAST(@hh AS VARCHAR), 2) + ':'
+ RIGHT('0' + CAST(@mm AS VARCHAR), 2) + ':'
+ RIGHT('0' + CAST(@ss AS VARCHAR), 2);
WAITFOR DELAY @delayTime;
END;
Analysis: ⚙️🧩🔍 This version worked cleanly and handled edge cases properly. Yet it still made assumptions (like the 24-hour cap). The AI provided a functional draft, but I had to finalize design choices. That’s where the human touch comes in—context, judgment, and foresight.
---
Why This Matters ⚖️
The allure of vibe coding is clear: describe your intent, get code instantly. But this experiment exposes the trade-offs.
- Speed vs. substance: Quick output doesn’t equal good engineering.
- Automation vs. understanding: Each line must still be reviewed for intent and accuracy.
- Convenience vs. clarity: Removing leftovers and clarifying constraints is still human work.
Used well, vibe coding accelerates learning and scaffolding. But as AI tools evolve weekly, many teams struggle to keep pace. Employers often demand immediate adoption, yet the ‘how’ changes faster than we can absorb, leaving little time for deep learning. Used blindly, it propagates confusion faster than ever before.
---
Karpathy’s Timeline: From Hype to Hand-Coding 🧭
- February 2024: Andrej Karpathy coins the term vibe coding on X (formerly Twitter), describing it as “coding by vibes—seeing stuff, saying stuff, running stuff.”
- April 2024: He demonstrates the approach with MenuGen, built almost entirely through LLM assistance, calling it an experiment in “human-AI co-programming.”
- Mid–2024: Enthusiasts flood social media with their own vibe-coded apps and demos. The term becomes shorthand for trusting AI to generate most of the code.
- October 2025: In a Futurism interview about his new project NanoChat, Karpathy admits:
“It’s basically entirely hand-written… I tried to use Claude / Codex agents a few times but they just didn’t work well enough at all and net unhelpful.” The father of vibe coding, it turns out, didn’t use vibe coding himself.
This isn’t hypocrisy—it’s an evolution. We’re at the stage where AI coding tools are brilliant companions but unreliable pilots. The hype cycle has to settle, just as early compilers, IDEs, and debuggers once did. Sometimes, progress belongs to the tortoise.
---
Closing Thoughts 💭
Vibe coding isn’t failure; it’s infancy. The tools are improving fast, but so must our literacy in how to use them. We can expect future versions to normalize inputs, catch leftover variables, and learn to ask the clarifying questions we had to supply manually. Until then, the real “vibe” worth following is disciplined curiosity.