r/SQL • u/eww1991 • Sep 02 '26
Discussion Ah yes, the table lake
Probably breaks rules but a quick guide on what not to name things I less you want accidents
523
Upvotes
r/SQL • u/eww1991 • Sep 02 '26
Probably breaks rules but a quick guide on what not to name things I less you want accidents
161
u/GreekGodofStats Sep 02 '26 •
Ahhhhh so this is the data lake I’ve been hearing so much about
29
u/chaosink Sep 02 '26
Lake');
DECLARE @DropConstraints NVARCHAR(max) = '' SELECT @DropConstraints += 'ALTER TABLE ' + QUOTENAME(OBJECT_SCHEMA_NAME(parent_object_id)) + '.' + QUOTENAME(OBJECT_NAME(parent_object_id)) + ' ' + 'DROP CONSTRAINT' + QUOTENAME(name) FROM sys.foreign_keys EXECUTE sp_executesql @DropConstraints; GO
DECLARE @DropTables NVARCHAR(max) = '' SELECT @DropTables += 'DROP TABLE ' + QUOTENAME(TABLE_SCHEMA) + '.' + QUOTENAME(TABLE_NAME) FROM INFORMATION_SCHEMA.TABLES EXECUTE sp_executesql @DropTables; GO
19
u/dittybopper_05H Sep 02 '26
Has anyone interrogated little Bobby Tables mother?
14
u/GTS_84 Sep 02 '26
If you properly paramaterize your queries this wouldn't cause any issues.
5
u/Optimal_Law_4254 Sep 02 '26 •
How Erie!
8
u/WendlersEditor Sep 02 '26
Guys I accidentally dropped a lake how do we get it back?
4
u/RandomiseUsr0 Sep 02 '26
Lake Bobby
7
u/philnotfil Sep 02 '26
For today's lucky 10,000.
https://xkcd.com/327/
3
u/AnActualWizardIRL Sep 03 '26
truncating the swamp
1
u/VengenaceIsMyName Sep 02 '26
Hahahaha
1
u/dougception Sep 02 '26
Obviously not following the basic principle of least privileged access.
1
u/Einar_Son_of_Bjorn Sep 03 '26
MariaDB would still execute that lake name if you glued it into a string. Drop-in compatibility includes drop-in disasters.The engine is fine. '); DROP TABLE lakes;-- is not a storage engine. Use placeholders..........
Or rename the lake to Lake_Ontario like the rest of us who enjoy having a schema on Monday.