March 6, 2023 at 12:00 am
Comments posted to this topic are about the item ChatGPT in SQL Server - Practical examples
March 6, 2023 at 8:40 am
I look forward to when we can provide a schema, and our users can say
"can you please give me a list of people and their email addresses who have donations totalling over $300 in this financial year"
(As a basic example)
And it spits out a dataset
March 6, 2023 at 10:00 am
There is no Age column in table structure.
UPDATE LaLigaPlayers
SET Age = DATEDIFF(YEAR, DateOfBirth, GETDATE());
March 6, 2023 at 7:51 pm
Something interesting... not sure why...
When the list countries by population is prepared.. why these countries were missed: Canada, Ukraine, Poland?
March 7, 2023 at 3:17 am
I'm a little surprised nobody has pointed out one of the biggest problems with AI-generated code: it can be flat-out wrong and give no indication of any uncertainty.
UPDATE LaLigaPlayers
SET Age = DATEDIFF(YEAR, DateOfBirth, GETDATE());
This is a common rookie mistake, and this code only works reliably for people born on New Year's Day. My daughter has told me a dozen times already this week "Daddy, I'm not 4 yet! My birthday isn't until next week!" But according to ChatGPT's code, she's been 4 since Jan 1. To calculate age correctly, it needs to account for whether the birthdate has already occurred in the current year, and this code fails to do that.
March 7, 2023 at 2:41 pm
Honestly, the fact that ChatGPT makes the mistake of thinking that people age on 01 Jan, which is such a fundamental error, show that it can't be relied on when you don't understand what the "solutions" it gives you are.
You caught onto another one of it's errors, using nvarchar
without a length, but that mistake is even more fatal; someone not paying attention could easily end up with significant data loss if they just implemented that solution.
If any of the names contain multiple words, this code will only capture the first word as the first name, and the remaining words as the last name.
Honestly, it is good that it told you this though; splitting full names into first (middle) and surname is an unsolved problem, and I will admit that's it's nice that the text it generated denotes that it, effectively, won't work correctly for people with 3+ names. It doesn't, however, handle scenarios where the name doesn't contain a space; which a "good" solution would.
The part on the LOGIN
with server admin privileges as well isn't right. Presumbly, by "serveradmin" you mean a system administrator, which is the server role sysadmin
, not serveradmin
; on a default instance that SQL would error.
Honestly, I see this article as little more than further cement that ChatGPT is quite a dangerous tool. For those that understand the output it gives then it's probably not actually that useful and likely they would have written the solution themselves. For those who don't understand it's output, then it can easier introduce fundamental flaws. We're going to end up with a "world" where isntead of people copy pasting from sites like Stack Overflow, they are copying from ChatGPT; which (from my experience) ends up with a lower reliability.
Thom~
Excuse my typos and sometimes awful grammar. My fingers work faster than my brain does.
Larnu.uk
March 7, 2023 at 9:02 pm
The mistake is using the generic ChatGPT for questions in SQL. This version of the chatbot IS a rookie. There is a version of CHATGPT trained specifically for programming and SQL called 'Copilot' that used the contents of GITHUB for training rather than the text version of the internet.
March 7, 2023 at 9:06 pm
The rookie mistake is using the wrong version of CHATCPT for programming questions. There is a version specifically trained on the entire contents of GITHUB for use in programming named CoPilot.
March 7, 2023 at 9:09 pm
Using the 'CoPilot' version of ChatGPT ( that is an addon to Microsoft Visual Studio) trained in programming and with access to the data sources this is possible now.
March 8, 2023 at 8:52 am
Using the 'CoPilot' version of ChatGPT ( that is an addon to Microsoft Visual Studio) trained in programming and with access to the data sources this is possible now.
As you posted this thrice, I'm guessing you're a big fan..?
Thom~
Excuse my typos and sometimes awful grammar. My fingers work faster than my brain does.
Larnu.uk
March 8, 2023 at 8:00 pm
The mistake is using the generic ChatGPT for questions in SQL. This version of the chatbot IS a rookie. There is a version of CHATGPT trained specifically for programming and SQL called 'Copilot' that used the contents of GITHUB for training rather than the text version of the internet.
Heh... GitHub... Why do people think that's a source of good information or code? 😀 It can be but it's not guaranteed any more than finding a correct answer on a forum. 😉
--Jeff Moden
Change is inevitable... Change for the better is not.
March 8, 2023 at 8:06 pm
I'm a little surprised nobody has pointed out one of the biggest problems with AI-generated code: it can be flat-out wrong and give no indication of any uncertainty.
UPDATE LaLigaPlayers
SET Age = DATEDIFF(YEAR, DateOfBirth, GETDATE());This is a common rookie mistake, and this code only works reliably for people born on New Year's Day. My daughter has told me a dozen times already this week "Daddy, I'm not 4 yet! My birthday isn't until next week!" But according to ChatGPT's code, she's been 4 since Jan 1. To calculate age correctly, it needs to account for whether the birthdate has already occurred in the current year, and this code fails to do that.
Worse than that, it is worded in such a fashion that as to make it sound like the code it produces is correct. As someone once said to me about it, it's "Confidently Incorrect". It does meet the requirement of "getting close to human sounding" because it makes the same mistakes as humans and perpetuates my observation of "Half of all that is written is untrue and most of the other half is written is such a fashion that you can't tell".
--Jeff Moden
Change is inevitable... Change for the better is not.
March 9, 2023 at 2:45 pm
Using the 'CoPilot' version of ChatGPT ( that is an addon to Microsoft Visual Studio) trained in programming and with access to the data sources this is possible now.
I'd be very careful about using CoPilot. Besides the possible problems of subpar code, there is currently a class-action lawsuit: https://githubcopilotlitigation.com/
I wouldn't trust AI generated code at this time. Maybe my kids will be able to do so.
March 9, 2023 at 3:17 pm
I was trying to reply to 3 different posts. The way the responses showed up looks like i just put a similar answer 3 times together.
March 9, 2023 at 3:20 pm
Of course it just makes positive statements. It is a bot, it is not introspective. It is just an advanced tool. As with any tool it is up to the intelligent user to decide how and how much to use the tool.
Viewing 15 posts - 1 through 15 (of 26 total)
You must be logged in to reply to this topic. Login to reply