« first day (4478 days earlier)      last day (687 days later) » 

06:08
Wordle 659 4/6

⬛⬛⬛🟨⬛
⬛⬛🟩⬛⬛
🟨⬛🟩🟨⬛
🟩🟩🟩🟩🟩
06:22
Morning
 
1 hour later…
07:29
Wordle 659 4/6

⬛⬛⬛⬛⬛
⬛🟨⬛⬛⬛
🟩⬛🟨🟨⬛
🟩🟩🟩🟩🟩
wtf is this

Wordle 659 5/6*

⬛⬛🟩🟨⬛
🟩⬛🟩⬛🟨
🟩🟩🟩⬛⬛
🟩🟩🟩⬛⬛
🟩🟩🟩🟩🟩
 
1 hour later…
08:47
ha ha ha
 
3 hours later…
12:06
Can someone explain to me what is going on in this script?
Seems to me like a bug somewhere. Either you are allowed to alter a schema-bound function to recurse (in which case Try2 should work the same as Try3) or you are not, because ALTER is actually working like DROP...CREATE (in which case Try3 should not work and Try4 should return a different error)
Upshot is: you can get around the restriction on schema-binding a recursion by using CREATE OR ALTER twice.
Edge Cases are Awesome, which is my band name
Wordle 659 5/6*

🟩⬛⬛⬛⬛
🟩⬛🟩⬛⬛
🟩⬛🟩🟨⬛
🟩🟩🟩⬛🟨
🟩🟩🟩🟩🟩
12:53
INSERT CURSOR
@PaulWhite What on earth did you use to get that plan
API cursor insert
13:30
For anyone interested
13:45
Oh not this again
Yep, it's API cursor time
Normally, I bang on about them for paging queries
I don't think I've mentioned cursor inserts before
Yeah I remember the heap paging question
Another thing the lame T-SQL cursor implementation doesn't support
You can UPDATE or DELETE WHERE CURRENT OF a cursor, but there's no INSERT
There's no particular use to it, I just found it interesting
14:02
Hrm
Cursor insert with IDENTITY_INSERT ON
I also like the fact this works (no cursor) dbfiddle.uk/rY2KZnXw
Again, no particular point to it
14:17
Is the hash join to avoid a spool
Aside from forcing join order
Yes!
Or a sort in the case of a merge join hint
Local man hates spools and sorts
I love all execution plan operators
But often, less (fewer) is more
No one likes scrolling do they
I enjoy it quite a bit
Oh well in general perhaps. I meant scrolling around a huge execution plan
That's not fun
14:43
As long as it’s an actual execution plan double plus good I don’t mind
Paid by the pixel
15:09
I wish I knew why the OUTPUT clause is designed to go in the most obtrusive and confusing part of the query rather than at the very end
I often get it wrong the first time
But SQL makes no sense anyway
It should start with the FROM clause
15:23
Charlie: you do not need dynamic sql
Also Charlie: constructs dynamic sql
0
A: Backup syntax error with constructed string

CharliefaceYou cannot use a calculated string directly in a BACKUP or RESTORE statement. But contrary to popular understanding, you can use a variable, you do not need dynamic SQL. DECLARE @file nvarchar(255) = 'G:\SP_Backup_Daily\iMIS_Prod_' + CONVERT(nvarchar(50), GETDATE(), 112) + '.bak'; ...

Is Glorfindel a dead link bot or an actual person
I can never tell
15:58
Glorfindel is many things, least not a link corrector, spam destroyer, and all around good human
Glorfindel ♦, Ermelo, The Netherlands
6.4k 3 18 41
@PaulWhite I saved your cool example to my list of things you do better than me
(Its a big list)
16:22
Well then
16:48
This looks interesting. We don't get a lot of obvious ChatGPT-generated content, but for those times where we do...
17:05
@ErikDarling Argh I thought I made it clear. Variables != dynamic SQL. You can use variables on all parts of a BACKUP clause without using sp_executesql
In other words, doing BACKUP DATABASE @db TO DISK = @file is not dynamic SQL. SET @SQL = 'BACKUP DATABASE ' + @db + ' TO ...' EXEC(@SQL) is dynamic.
17:47
Well yeah but you’re holding dynamic sql in a variable instead
To me building a string like that is dynamic sql but you’re free to disagree
18:09
@HannahVernon I find it hard to believe that one can be a good moderator of 8 groups - some of them heavy-duty ( Chess, English Language Learners, Spanish Language).
18:20
> Store your constructed string in a variable first, or use dynamic SQL.
I guess one can never be too clear about these things
Reading comprehension being what it is these days
@HannahVernon Is apostrophe usage on the list at all
@PaulWhite I saw that but didn't feel it was clear enough or stressing enough the fact you don't need dynamic SQL. The amount of times I see badly constructed dynamics is unreal.
You certainly added enough emphasis to your answer
@ErikDarling No, dynamic SQL is dynamic code ie the code itself is dynamically produced. By your same argument every parameterized query is dynamic, which is obviously nonsense.
Yes the file name is constructed dynamically, but there is little meaning to it apart from the \ symbols, there is no mixing of code and data there
Argh markdown strikes again
I disagree but ok
Please explain. How is BACKUP DATABASE @db different from SELECT * FROM T WHERE col = @x
18:35
I find the CONVERT(VARCHAR(50), 'GETDATE(), 112)' in that question offensive
112 = yyyymmdd
not v variable
@PaulWhite seems to be a typo with the apostrophes
I always forget ` ```tsql` doesn't work on Database Administrators, rather unobviously
It does 'work' in as much as it selects the same formatting as the tag, which like most tags, has lang-sql as its syntax highlighting style. That same style is the default for the whole site.
@Charlieface Yes, that's how it is in the question. That's not the point I'm making.
So what point are you making? sorry bit dense today
The result of converting GETDATE to a string using style 112 has a fixed length
As I thought I explained already
19:20
@PaulWhite of course its
@Vérace depends what one considers "good" I suppose.
Anyway did anyone have any insight on my fiddle upthread?
Might just post it as a full question, but it's just my curiosity
19:36
Sounds like it would make a good question
Maybe even a great question
19:56
Wordle 666 is only a week away 👹
Are you going to eat some devil booty pizza to celebrate
@ErikDarling I disagree with both of you, but I don't know anything.
E.g. I would consider EXEC sp_ExecuteSQL N'SELECT 1 AS A' as dynamic SQL.
I’m fine moving on from this
20:12
Happy Easter 🐰
Hoppy Easter 🍺
Hippy Easter 🍄
@J.D. Agreed, but only in the very technical sense that it's dynamically parse and executed at runtime. It's not really dynamic in the overall "this is going to wipe your database" sense.
20:29
Yea I know whatcha mean. I just wanted to give a counter example to "the code itself is dynamically produced". But I also agree that just because a variable is used doesn't necessarily make it dynamic SQL either.
But in the interest of moving on... Hempy Easter? 🥬🚬
20:40
Who says I do Easter? Happy spring holidays anyway... Oh southern hemisphere whoops soz
20:55
Beannachtaí na nÉirí Amach na Cásca agaibh go léir! Easter Rising blessings to all!
3
21:06
@HannahVernon Posted now
0
Q: Schema-binding with recursive scalar UDF

CharliefaceTL;DR; Is it a bug that SQL Server allows a scalar UDF to recursively call itself when schema-bound, but only when altered to do so using the CREATE OR ALTER syntax? Or is it a bug that other syntaxes are disallowed? A trivial recursive scalar UDF can be constructed as follows CREATE FUNCTION db...

21:36
@Vérace finally a language I understand
 
1 hour later…
22:47
After ChatGPT
@Charlieface awesome!

« first day (4478 days earlier)      last day (687 days later) »