June 9, 2017 at 10:43 am
LOL just got this message from a Facebook friend. "While working on a SQL statement just now I ran into an issue that I needed a little help to solve. I search for my issue, found similar question and the solution and began to implement the recommendation. The avatar of the person who solved the issue caught my attention and when I glanced over I saw a familiar name. Thanks for the help, six years after your original post :)"
Nice to know that this stuff still helps people.
_______________________________________________________________
Need help? Help us help you.
Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.
Need to split a string? Try Jeff Modens splitter http://www.sqlservercentral.com/articles/Tally+Table/72993/.
Cross Tabs and Pivots, Part 1 – Converting Rows to Columns - http://www.sqlservercentral.com/articles/T-SQL/63681/
Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs - http://www.sqlservercentral.com/articles/Crosstab/65048/
Understanding and Using APPLY (Part 1) - http://www.sqlservercentral.com/articles/APPLY/69953/
Understanding and Using APPLY (Part 2) - http://www.sqlservercentral.com/articles/APPLY/69954/
June 9, 2017 at 12:53 pm
Lynn Pettis - Friday, June 9, 2017 12:44 PMSometimes you have to wonder about people writing SQL code and this is just one example. I am currently working through some code here at work that simply confirms that some people should not be allowed to write SQL code without proper supervision.
I came across this little gem to generate a datestamp in dos, this can be done in one easy to understand line and I have no idea what this is actually doing. My only theory is that whoever created it bashed their head onto their keyboard until this happened.
for /F "tokens=2,3,4 delims=/ " %%i in ('date/t') do set y=%%k
for /F "tokens=2,3,4 delims=/ " %%i in ('date/t') do set d=%%k%%i%%j
for /F "tokens=5-8 delims=:. " %%i in ('echo.^| time ^| find "current" ') do set t=%%i%%j
set t=%t%_
if "%t:~3,1%"=="_" set t=0%t%
set t=%t:~0,4%
set "theFilename=%d%_%1%"
echo %theFilename%
June 9, 2017 at 4:14 pm
ZZartin - Friday, June 9, 2017 12:53 PMLynn Pettis - Friday, June 9, 2017 12:44 PMSometimes you have to wonder about people writing SQL code and this is just one example. I am currently working through some code here at work that simply confirms that some people should not be allowed to write SQL code without proper supervision.I came across this little gem to generate a datestamp in dos, this can be done in one easy to understand line and I have no idea what this is actually doing. My only theory is that whoever created it bashed their head onto their keyboard until this happened.
for /F "tokens=2,3,4 delims=/ " %%i in ('date/t') do set y=%%k
for /F "tokens=2,3,4 delims=/ " %%i in ('date/t') do set d=%%k%%i%%j
for /F "tokens=5-8 delims=:. " %%i in ('echo.^| time ^| find "current" ') do set t=%%i%%j
set t=%t%_
if "%t:~3,1%"=="_" set t=0%t%
set t=%t:~0,4%
set "theFilename=%d%_%1%"
echo %theFilename%
I'm versed in DOS, but like you, I think someone did a lot of copy/paste they didn't understand. Or, maybe they went so far down a rabbit hole that this is all that was left by the time they came back up.
June 11, 2017 at 5:17 pm
Lynn Pettis - Friday, June 9, 2017 12:44 PMSometimes you have to wonder about people writing SQL code and this is just one example. I am currently working through some code here at work that simply confirms that some people should not be allowed to write SQL code without proper supervision.
Heh, you're so funny. 🙂
Can you guess the name of the vendor of this piece of code? IF (@step_id <= @max_step_id)
BEGIN
UPDATE msdb.dbo.sysjobsteps
SET step_id = step_id + 1
WHERE (step_id >= @step_id)
AND (job_id = @job_id)
-- Clean up OnSuccess/OnFail references
UPDATE msdb.dbo.sysjobsteps
SET on_success_step_id = on_success_step_id + 1
WHERE (on_success_step_id >= @step_id)
AND (job_id = @job_id)
UPDATE msdb.dbo.sysjobsteps
SET on_fail_step_id = on_fail_step_id + 1
WHERE (on_fail_step_id >= @step_id)
AND (job_id = @job_id)
UPDATE msdb.dbo.sysjobsteps
SET on_success_step_id = 0,
on_success_action = 1 -- Quit With Success
WHERE (on_success_step_id = @step_id)
AND (job_id = @job_id)
UPDATE msdb.dbo.sysjobsteps
SET on_fail_step_id = 0,
on_fail_action = 2 -- Quit With Failure
WHERE (on_fail_step_id = @step_id)
AND (job_id = @job_id)
END
I bet you can.
It seems the developer you referenced was "learning from the masters".
_____________
Code for TallyGenerator
June 12, 2017 at 4:16 am
Lynn Pettis - Friday, June 9, 2017 12:44 PMSometimes you have to wonder about people writing SQL code and this is just one example. I am currently working through some code here at work that simply confirms that some people should not be allowed to write SQL code without proper supervision.
<dramatic sigh> I wish people would quit talking about my code. :hehe:
Truth, that isn't my code, but some days I do tend to over engineer stuff because I get wrapped up in the user's "Dragon Poker" business rules.
EDIT: Added URL to reference.
June 12, 2017 at 4:17 am
Sergiy - Sunday, June 11, 2017 5:17 PMCan you guess the name of the vendor of this piece of code?IF (@step_id <= @max_step_id)
BEGIN
UPDATE msdb.dbo.sysjobsteps
SET step_id = step_id + 1
WHERE (step_id >= @step_id)
AND (job_id = @job_id)-- Clean up OnSuccess/OnFail references
UPDATE msdb.dbo.sysjobsteps
SET on_success_step_id = on_success_step_id + 1
WHERE (on_success_step_id >= @step_id)
AND (job_id = @job_id)UPDATE msdb.dbo.sysjobsteps
SET on_fail_step_id = on_fail_step_id + 1
WHERE (on_fail_step_id >= @step_id)
AND (job_id = @job_id)UPDATE msdb.dbo.sysjobsteps
SET on_success_step_id = 0,
on_success_action = 1 -- Quit With Success
WHERE (on_success_step_id = @step_id)
AND (job_id = @job_id)UPDATE msdb.dbo.sysjobsteps
SET on_fail_step_id = 0,
on_fail_action = 2 -- Quit With Failure
WHERE (on_fail_step_id = @step_id)
AND (job_id = @job_id)
ENDI bet you can.
It seems the developer you referenced was "learning from the masters".
I confess to cluelessness on this one. If no one else gets it right, will you reveal the answer?
June 12, 2017 at 6:44 am
Brandie Tarvin - Monday, June 12, 2017 4:17 AMI confess to cluelessness on this one. If no one else gets it right, will you reveal the answer?
Oh, you must be kidding me.
It's so easy:sp_helptext 'msdb.[dbo].[sp_add_jobstep_internal]'
_____________
Code for TallyGenerator
June 12, 2017 at 11:41 am
Sergiy - Sunday, June 11, 2017 5:17 PMLynn Pettis - Friday, June 9, 2017 12:44 PMSometimes you have to wonder about people writing SQL code and this is just one example. I am currently working through some code here at work that simply confirms that some people should not be allowed to write SQL code without proper supervision.Heh, you're so funny. 🙂
Can you guess the name of the vendor of this piece of code?IF (@step_id <= @max_step_id)
BEGIN
UPDATE msdb.dbo.sysjobsteps
SET step_id = step_id + 1
WHERE (step_id >= @step_id)
AND (job_id = @job_id)-- Clean up OnSuccess/OnFail references
UPDATE msdb.dbo.sysjobsteps
SET on_success_step_id = on_success_step_id + 1
WHERE (on_success_step_id >= @step_id)
AND (job_id = @job_id)UPDATE msdb.dbo.sysjobsteps
SET on_fail_step_id = on_fail_step_id + 1
WHERE (on_fail_step_id >= @step_id)
AND (job_id = @job_id)UPDATE msdb.dbo.sysjobsteps
SET on_success_step_id = 0,
on_success_action = 1 -- Quit With Success
WHERE (on_success_step_id = @step_id)
AND (job_id = @job_id)UPDATE msdb.dbo.sysjobsteps
SET on_fail_step_id = 0,
on_fail_action = 2 -- Quit With Failure
WHERE (on_fail_step_id = @step_id)
AND (job_id = @job_id)
ENDI bet you can.
It seems the developer you referenced was "learning from the masters".
You know what, MS is MS and from what I can tell their developers aren't coming here to ask questions.
June 12, 2017 at 11:43 am
Sergiy - Monday, June 12, 2017 6:44 AMBrandie Tarvin - Monday, June 12, 2017 4:17 AMI confess to cluelessness on this one. If no one else gets it right, will you reveal the answer?Oh, you must be kidding me.
It's so easy:sp_helptext 'msdb.[dbo].[sp_add_jobstep_internal]'
And sarcasm must be a foreign language to you. :hehe:
June 13, 2017 at 5:01 am
As part of my Grace Hopper SOL session, I'm committed to naming the different types of database platforms and it occurs to me that I know of a few off the top of my head: SQL Server, Oracle, NoSQL, MySQL, and DB2.
Any others that I'm missing?
I only have about 10 minutes to lay out what types of DB administrators there are, mention the different platforms, and explain why databases are so important to modern life before giving 10 minutes of questions and give and take on the session (each one only lasts 20 minutes), so I have to be brief. Any thoughts you'd like me to incorporate into this?
June 13, 2017 at 5:03 am
Brandie Tarvin - Tuesday, June 13, 2017 5:01 AMAs part of my Grace Hopper SOL session, I'm committed to naming the different types of database platforms and it occurs to me that I know of a few off the top of my head: SQL Server, Oracle, NoSQL, MySQL, and DB2.Any others that I'm missing?
I only have about 10 minutes to lay out what types of DB administrators there are, mention the different platforms, and explain why databases are so important to modern life before giving 10 minutes of questions and give and take on the session (each one only lasts 20 minutes), so I have to be brief. Any thoughts you'd like me to incorporate into this?
How to post a question to get the most help http://www.sqlservercentral.com/articles/Best+Practices/61537
June 13, 2017 at 5:17 am
Brandie Tarvin - Tuesday, June 13, 2017 5:01 AMAs part of my Grace Hopper SOL session, I'm committed to naming the different types of database platforms and it occurs to me that I know of a few off the top of my head: SQL Server, Oracle, NoSQL, MySQL, and DB2.Any others that I'm missing?
I only have about 10 minutes to lay out what types of DB administrators there are, mention the different platforms, and explain why databases are so important to modern life before giving 10 minutes of questions and give and take on the session (each one only lasts 20 minutes), so I have to be brief. Any thoughts you'd like me to incorporate into this?
Given the limited time you have, I'd suggest starting with explaing the difference between "relational" databases (such as SQL Server, Oracle, PostgreSQL, MySQL, DB2), that have a strong schema and strong ACID guarantees; versus the so-callled "NoSQL" databases (for which I'll let someone else chime in with examples because I don't know which are big at this time) that are typically schema-free and have various degrees of looseness on the ACID properties.
Both these two types have their uses. The mistake is to try to think that one type can do the work of both. They CAN but you SHOULDN'T. (Just as you CAN clip your nails with a hedge trimmer or trim your hedge with a nailclipper, but most people would prefer to have one of each).
As to why databases are important in modern life: They are not. Data is important. How much data do we collect now as opposed to some decades ago? How is that data used to support our life (decision making, but also leasure - just think about all the statistics in sports broadcasts if you want an example from outside of the boardroom), nd how long arre we prepared to wait for that data. The database is just a tool to support this.
June 13, 2017 at 5:50 am
Brandie Tarvin - Tuesday, June 13, 2017 5:01 AMAs part of my Grace Hopper SOL session, I'm committed to naming the different types of database platforms and it occurs to me that I know of a few off the top of my head: SQL Server, Oracle, NoSQL, MySQL, and DB2.Any others that I'm missing?
I only have about 10 minutes to lay out what types of DB administrators there are, mention the different platforms, and explain why databases are so important to modern life before giving 10 minutes of questions and give and take on the session (each one only lasts 20 minutes), so I have to be brief. Any thoughts you'd like me to incorporate into this?
Types of platforms I'd go different:
Relational, Object, ID/Value, Unstructured, Semi-structured
What you have is kind of a mix between products & platforms, NoSQL being more of a platform than the products you listed, SQL Server Oracle MySQL & DB2.
"The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
- Theodore Roosevelt
Author of:
SQL Server Execution Plans
SQL Server Query Performance Tuning
June 13, 2017 at 6:23 am
I'd agree with Grant and Hugo, rather than getting down to individual RDBMS systems, think 1000ft view, especially with the limited timeframe for the presentation. Think "explaining to the CXX Executives," rather than "explaining to the techies."
Viewing 15 posts - 58,891 through 58,905 (of 66,712 total)
You must be logged in to reply to this topic. Login to reply