May 2, 2019 at 2:03 pm
Have you ever encountered some code that makes you feel that you need wine instead of coffee to fix it? Or is it just me?
I'm working on a code that has scalar functions inside scalar function inside scalar functions and I'm not sure if I'll get to the bottom of this. The worst part will be testing.
Normally for me, it requires either a good scotch or Drambuie and ice cream. 😀 The cool part about such finds is that they continue to justify my existence in the company not to mention good fodder for presentations.
--Jeff Moden
Change is inevitable... Change for the better is not.
May 2, 2019 at 2:12 pm
Luis Cazares wrote:Have you ever encountered some code that makes you feel that you need wine instead of coffee to fix it? Or is it just me?
I encountered this code to date stamp a file, fortunately I didn't have to fix it just replace it.
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%.txt"
echo %theFilename%
Now that's interesting
May 2, 2019 at 2:32 pm
Have you ever encountered some code that makes you feel that you need wine instead of coffee to fix it? Or is it just me? I'm working on a code that has scalar functions inside scalar function inside scalar functions and I'm not sure if I'll get to the bottom of this. The worst part will be testing.
Sounds like the Avaya database we have at the office, which has SP's that call SP's that call SPs, all with (normally scalar) functions that call further functions. Just to add to it, it even has a delimited string splitter than uses a WHILE
loop! I don't think any amount of alcohol or coffee will help with the disaster it is.
I really hope Avaya don''t still make their databases like that (as we're still using their software from 2009 at the moment).
Thom~
Excuse my typos and sometimes awful grammar. My fingers work faster than my brain does.
Larnu.uk
May 2, 2019 at 2:38 pm
Luis Cazares wrote:Have you ever encountered some code that makes you feel that you need wine instead of coffee to fix it? Or is it just me?
I encountered this code to date stamp a file, fortunately I didn't have to fix it just replace it.
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%.txt"
echo %theFilename%
Heh - that looks familiar. Here's a snip of one of my batch files:
:GetDate yy mm dd
::-----------------------------------------------------------------------------------
::returns the date components in the format yyyy, mm, dd
setlocal ENABLEEXTENSIONS
set t=2&if "%date%z" LSS "A" set t=1
for /f "skip=1 tokens=2-4 delims=(-)" %%a in ('echo/^|date') do (
for /f "tokens=%t%-4 delims=.-/ " %%d in ('date/t') do (
set %%a=%%d&set %%b=%%e&set %%c=%%f))
endlocal&set %1=%yy%&set %2=%mm%&set %3=%dd%&goto :EOF
::-----------------------------------------------------------------------------------
All I do is call it, passing 3 variables that'll be returned with the year, month and day. It's not technically a function, but it's close. 🙂
I have another one for setting the time.
May 2, 2019 at 7:06 pm
You do have to wonder if someone is maybe a little out of their depth trying to use SQL Server, when they post photos (not screenshots) of computer's screen. One would hope that they at least have awareness of the print screen key. ??
Maybe they're just stuck with systems such as the Samsung NP550P7C which don't have a print screen key. Do you check the keyboard layout before chosing a PC/Laptop/Tablet?
Tom
May 2, 2019 at 7:11 pm
Thom A wrote:You do have to wonder if someone is maybe a little out of their depth trying to use SQL Server, when they post photos (not screenshots) of computer's screen. One would hope that they at least have awareness of the print screen key. ??
Maybe they're just stuck with systems such as the Samsung NP550P7C which don't have a print screen key. Do you check the keyboard layout before chosing a PC/Laptop/Tablet?
I do check them. I've found out that the "Ñ" key is actually a luxury on this side of the Atlantic.
May 2, 2019 at 7:11 pm
Thom A wrote:You do have to wonder if someone is maybe a little out of their depth trying to use SQL Server, when they post photos (not screenshots) of computer's screen. One would hope that they at least have awareness of the print screen key. ??
Maybe they're just stuck with systems such as the Samsung NP550P7C which don't have a print screen key. Do you check the keyboard layout before chosing a PC/Laptop/Tablet?
They must also be pre-Windows 7. I believe that's when the snipping tool was first included in the OS. It's a good chance that it's simply a PEBKAC error.
May 2, 2019 at 7:22 pm
TomThomson wrote:Thom A wrote:You do have to wonder if someone is maybe a little out of their depth trying to use SQL Server, when they post photos (not screenshots) of computer's screen. One would hope that they at least have awareness of the print screen key. ??
Maybe they're just stuck with systems such as the Samsung NP550P7C which don't have a print screen key. Do you check the keyboard layout before chosing a PC/Laptop/Tablet?
I do check them. I've found out that the "Ñ" key is actually a luxury on this side of the Atlantic.
So do I. I know it sounds trivial, but I like the back-lit keyboard that I can turn on and off; it's nice when working in low light.
I also want a numeric keypad and I don't want the keys right on top of one another. If the keyboard is too small to have normal-sized keys or a numeric keypad, then it's too small for me to use. I don't even look at one if it's less than 17". Then there's the power and internals, but I'm sure we all look at that.
May 2, 2019 at 8:43 pm
They must also be pre-Windows 7. I believe that's when the snipping tool was first included in the OS.
I hope not, anyone me older than Windows 7 is well out of support now. Although I know many of us still have to suffer unsupported versions of SQL Server (I'm glad that we got our 2008 switched off last month).
Do you check the keyboard layout before chosing a PC/Laptop/Tablet?
Most definitely. I'm not a fan of Tenkeyless keyboards at all, so when buying a laptop I made sure it had a full size keyboard. As for the keyboard I use on my work/home PC, they're the same model for both. Made sure they were both UK QWERTY (as there's a lot of good models that have limited availability or some switches are only available in US QWERTY), and again made sure they were full keyboard size.
For those of us that spend a lot of our time typing, choosing the right keyboard is really important. 🙂
Thom~
Excuse my typos and sometimes awful grammar. My fingers work faster than my brain does.
Larnu.uk
May 2, 2019 at 8:52 pm
TomThomson wrote:Maybe they're just stuck with systems such as the Samsung NP550P7C which don't have a print screen key. Do you check the keyboard layout before chosing a PC/Laptop/Tablet?
I do check them. I've found out that the "Ñ" key is actually a luxury on this side of the Atlantic.
I gave up all hope of ever having a complete keyset a long time ago, because I am typing stuff in (Modern)English, Irish Gaelic, Scottish Gaelic, French, Spanish, Italian, Middle English, and German and that means that instead of just 52 alphabetic characters (26 lower case and 26 upper case) needed for English I have to work with another 66 vowels and 17 consonants (9 lower case, and 8 upper case) plus of course 35 Modern English punctuation marks and 5 other punctuation marks. So I have to work around a keyboard which doesn't offer all that, and use character macros and have a page with all the difficult characters on it so that I can copy and paste if I don't remember the macro for some character.
And of course on top of that stuff I still occassionally write about mathematics and in particular set theory and logic and that tends to require quite a few Greek and Hebrew characters.
Tom
May 3, 2019 at 5:35 am
Have you ever encountered some code that makes you feel that you need wine instead of coffee to fix it? Or is it just me? I'm working on a code that has scalar functions inside scalar function inside scalar functions and I'm not sure if I'll get to the bottom of this. The worst part will be testing.
That doesn't sound like a job for wine. That's a job for scotch.
"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
May 3, 2019 at 10:38 am
Thom A wrote:You do have to wonder if someone is maybe a little out of their depth trying to use SQL Server, when they post photos (not screenshots) of computer's screen. One would hope that they at least have awareness of the print screen key. ??
Maybe they're just stuck with systems such as the Samsung NP550P7C which don't have a print screen key. Do you check the keyboard layout before chosing a PC/Laptop/Tablet?
Yes. I like to have a separate numeric keypad. It makes using Sibelius a lot easier.
Thomas Rushton
blog: https://thelonedba.wordpress.com
May 6, 2019 at 1:32 pm
Yesterday night, a job failed with a weird error I'd never seen before. I hop onto Google this morning to search for it and find all sorts of interesting responses. Including this little gem:
Change your query to SCHEMA.dbo.TableName
Because … reasons.
<headdesk>
This thread is from 3 years ago and no one called out that comment or bothered to down vote it. Even a comment posted to that comment said "and how exactly will this help?" as if the respondent to the erroneous comment also failed to notice the problem.
This makes me very very very sad.
May 6, 2019 at 1:34 pm
Annnnnddddd...
Because I just realized y'all are going to ask.
May 6, 2019 at 1:39 pm
Yesterday night, a job failed with a weird error I'd never seen before. I hop onto Google this morning to search for it and find all sorts of interesting responses. Including this little gem:
Change your query to SCHEMA.dbo.TableName
Because … reasons. <headdesk> This thread is from 3 years ago and no one called out that comment or bothered to down vote it. Even a comment posted to that comment said "and how exactly will this help?" as if the respondent to the erroneous comment also failed to notice the problem. This makes me very very very sad.
It's obvious that if you change to a different database, everything will work as expected. 😀
Viewing 15 posts - 63,451 through 63,465 (of 66,738 total)
You must be logged in to reply to this topic. Login to reply