« first day (2253 days earlier)      last day (2621 days later) » 

6:36 AM
Now I know what the TDS in FreeTDS stands for, thanks Paul :)
 
7:08 AM
Thank you McNets and Paul. ( and good morning)
 
 
1 hour later…
8:32 AM
Good morning
 
8:58 AM
Good Morning
 
user image
2
Morning
 
morning
 
9:32 AM
@PaulWhite morning
what's the context?
 
@dezso None. Just found it amusing in itself.
Or the context is every moderation operation anywhere at any time. You choose.
 
I see
 
@PaulWhite length? not to mention great length? I see shorth above :D
 
Length is relative.
Great length doubly so.
 
9:36 AM
@PaulWhite great is objectively correct great
 
I lack sufficient experience to know if that is true or not.
 
9:55 AM
Good morning
 
@AndriyM 2U2
 
10:07 AM
@ypercubeᵀᴹ those columns are marked UNIQUE in their table definition. Did you mean UNIQUE (first_session, last_session)?
 
@dezso The OP's 2nd design suggests he wants that (what you say, a composite unique constraint). The 1st design has 2 unique constraints, separately in each column. I'm only asking for clarification
@dezso And you can define multiple FKs on the same column. (but not on an expression)
 
@ypercubeᵀᴹ really?
 
@dezso A column that references different tables? Yes. A column that is referenced by different tables or column? Yes
 
@ypercubeᵀᴹ very interesting, I've learnt something new
 
You can even have redundant FKs, eg. 2 identical FKs from the same table/column to the same table/column.
Only the name will differ
 
10:17 AM
You can never be too sure with foreign keys.
 
It's always a good idea to have a spare key.
2
 
10:53 AM
This DBA.SE question
0
Q: SQL Server stored procedure to insert/ update which has date

user2698249The source which has date in dd-MMM-yy format , have to convert it yyyy-mm-dd hh:mm:ss:SS and insert/update into the Database using stored procedure.New to stored procedure I am managed to write a stored procedure but I dont where or how to convert the data format. ALTER PROCEDURE [dbo].[uspInse...

was asked shortly after this SO question
0
Q: SQL Server stored procedure to insert/ update which has date

xyzThe source which has date in dd-MMM-yy format, have to convert it to yyyy-mm-dd hh:mm:ss:SS and insert/update into the database using stored procedure. New to stored procedure I managed to write a stored procedure but I don't where or how to convert the date format. ALTER PROCEDURE [dbo].[uspIn...

But the DBA.SE account is linked to a different SO account.
Not sure what could be the best course of action. I mean, our copy could just be closed. Alternatively, though, it could be migrated to SO and closed there as a duplicate.
 
@AndriyM Too old to migrate. Closed & deleted here.
 
Only I don't remember whether a question needs to have an upvoted answer or any answer to serve as the target when closing as a dupe.
@PaulWhite Ah, indeed.
 
@AndriyM It's always a good idea to have a spare question.
 
One other point is that the question appears to have been answered on MSDN.
@dezso Touche :)
 
@AndriyM Any answer (even zero score) except mods.
 
@hot2use Flag "should be closed ... duplicate". That will start a review process.
 
11:30 AM
Hi all
 
11:47 AM
@PaulWhite done
 
12:00 PM
@dezso it seems htey wanted something different after all. (non-overlapping ranges).
And I'm not sure that's entirely accurate either. I mean they reference the session ids while they might be better referencing the session timestamps.
 
12:59 PM
I have a question that is probably too simple for the website, I hope this is the right place:
When using Ola Hallengren's db maintenace script (https://ola.hallengren.com/), I noticed it is writing log files to a certain directory

But I found no sql command that generates these files in the scripts, and no table where the path to the files could be stored.

How is this done? What command creates these files?
 
@HugoRune It's likely one of the jobs created by MaintenanceSolution.sql
I can see some CMDEXEC ones that it creates for which it specifies an output file (probably to redirect standard output to).
So maybe more than one job generates them.
 
@HugoRune it just specifies an output on the job step & uses RAISERROR inside the procedure to write to that file
 
@AndriyM ah yes, in the advanced view of the step of a job, there is a field "output file" which contains the path.
thanks, it makes more sense now
 
1:36 PM
0
Q: What database refactoring tools are there?

JohnI'm looking for a database refactoring tool, preferably supporting Sql Server, that allows me to do operations like the following without hand-writing sql: Change the primary key of a table even if it's used as a foreign key. The foreign keys should change accordingly. Factor out a string colum...

^^^ surprised this isn't in the close queue, isn't it a classic shopping list Q?
 
It already is, because it is :)
I beleive this is the kind of question that Software Recommendations has been created for.
 
@McNets will soon be able to VtC I reckon ;)
 
1:51 PM
@JackDouglas VtC?
 
Vote to Close privilege. At 3k rep
 
Still far away
 
@McNets I'll bet on April 1st ;)
 
1
Q: PHP and Postgres: Why would I get “Error : Unable to open database ” when the credentials are correct?

Alex111I have Apache, PHP, and Postgres all installed on one CentOS 7.3. I have a .PHP script that does not use interactive user input that successfully connects to the Postgres database. So I know PHP and Postgres work. I now want to create new .PHP files for front end web development. I want a web pa...

@JackDouglas do you think this is ontopic in its current form?
 
2:09 PM
@ypercubeᵀᴹ @JackDouglas you're too optimistic. ;)
 
@dezso no I don't !
 
@JackDouglas hm-hm, I see only my VtC on it ;)
 
2:26 PM
good morning
 
morning
 
@dezso well, I can't vote :(
@McNets really? ^^^^
 
48
A: As a mod when should I vote to close content that is not flagged?

Shog9 Should I always treat my mod close vote as binding and reserve it for extreme situations, or should I treat my close vote as "normal" when it's the fifth and final vote anyway? Neither. It isn't a vote. Ever. Don't treat it like one. When you see a post you think should be closed, close it....

 
@JackDouglas I just hope that @PaulWhite doesn't decide to remove people that doesn't have 3k rep from the room owners
 
@PaulWhite that's just an excuse, no explanation :D
 
2:39 PM
@Lamak I am altering the deal, pray I don’t alter it any further.
2
 
I'll learn how to pray
 
@dezso Excuse? How? Only Jack can give his exact reasoning, but he chose to comment rather than closing.
 
@PaulWhite to 30K ?
 
@JackDouglas yes, but every day it is more difficult. the time I use to read and understand a question, it usually had more than one answer
on SO it's barely impossible
 
@ypercubeᵀᴹ Sorry I don't have a canned Star Wars response for that. Please try again.
 
2:42 PM
@McNets I just like the answers from some users in DBA just too much. So I feel discouraged to answer myself. But I'm scared of losing my room owner status now, so I actually posted an answer today (almost a whole year after my last one)
 
@Lamak Main rep doesn't qualify you for RO status here. Being a good chat moderator and regular heap citizen does.
 
@PaulWhite
 
@dezso Ah :-$
 
@PaulWhite well, one out of three seems good enough ;)
@PaulWhite so, I can safely post my next answer next year?
 
Actually the middle one is most important. After all, if RO privileges are never used, there seems little point in having them, right?
 
2:47 PM
@PaulWhite right boss
;)
 
@Lamak I guess that depends on how impressive you want your MVP contrbutions to look ;)
 
@PaulWhite Thanks for your help with this. I wrote it up. Naturally I missed an embarrassingly simple solution when looking at it earlier...
 
Heh. I'd make a great Darth Vader I reckon :)
 
@PaulWhite right, I don't want to lose those privileges either
@PaulWhite a kiwi darth vader:
 
@Lamak I did not mean your answer here, in fact I tend to misread questions, and I'm taking my time before to answer.
 
2:50 PM
user image
5
 
From a SQL Server consultancies "about us" page
> If we cannot fix it, only Microsoft can!
Talk about confidence
 
@Lamak Ha! That's awesome! Wherever did you find that?!
@JoeObbish What was the "embarrassingly simple" solution?
 
@PaulWhite the powers of Google Search multiply when are used for trolling reasons
 
I guess.
 
3:06 PM
@PaulWhite In some cases you can just put the UDF in the WHERE clause and it works. I'm used to that not working because we don't use SCHEMABINDING here for anything.
 
@PaulWhite and here is the link
 
Ah. TradeMe of course. I should have recognized Kevin.
 
you should have
 
@JoeObbish Ah, OK, thanks.
 
looks like Paul has 7 out of the ten starred messages on the sidebar
will he hit 10/10?
 
3:12 PM
@JoeObbish Consider also:
WITH cte (UDF_VALUE) AS
(
    SELECT DISTINCT dbo.EXPENSIVE_UDF() UDF_VALUE
    FROM dbo.X_ONE_ROW_TABLE
    GROUP BY () -- The only change
)
SELECT ID
FROM dbo.X_100_INTEGERS
INNER JOIN cte ON ID >= cte.UDF_VALUE;
A disaster when the function is schema bound.
The bottom line (in answer to the question) is you can't force it to be evaluated once, you can just hack at it and hope for the best.
 
@dezso well, in my defence, not that I did something, even though I didn't mod-close :)
 
@PaulWhite never used GROUP BY () , looks like a grand total calculation
so to throw a theory out there
optimizer knows there is one row
eliminates the DISTINCT
which allows the UDF to be deferred
of course there are lots of ways to write code which will lead to issues
but I don't quite follow on what you meant by "you can't force it"
by that do you mean you can write SQL which works in this version of SQL Server but may not in the next?
 
The GROUP BY () turns it into a vector aggregate.
 
@PaulWhite Oh, I see where you are going with that example
 
@JoeObbish Exactly. There's no documented way to force the number of times a scalar is evaluated or when (aside from CASE, and that only mostly works) in an execution plan. It's one of the fundamental freedoms of the QO.
 
3:19 PM
that's interesting, I would not have expected that
I can change the question to "encourage" if you like... I mainly used "force" to help people searching for a solution
 
@JoeObbish If you haven't seen it before, read the comments on Itzik's Connect item
@JoeObbish Or qualify the answer.
It is true that the QO is much less free to reorder non-det UDFs, but even that only adds a restriction, not a guarantee of the outcome.
 
This is a clear example of what I said. stackoverflow.com/a/42629201/3270427
 
@PaulWhite made an edit. Feel free to edit further if you like, have to run to a long meeting now
 
@JoeObbish Yes I saw, that seems much better. I'll read it properly later. I have chat messages to get starred.
7
Ha ha ha whoever that was.
SELECT x1.ID
FROM dbo.X_100_INTEGERS x1
WHERE x1.ID >= (SELECT MAX(dbo.EXPENSIVE_UDF()));
Scalar aggregates are currently reasonably reliable in this respect, but I wouldn't want to base my company on it.
 
3:55 PM
7
Q: Database design: Normalizing a "(many-to-many)-to-many" relationship

Michael UnderwoodShort version I have to add a fixed number of additional properties to each pair in an existing many-to-many join. Skipping to the diagrams below, which of Options 1-4 is the best way, in terms of advantages and disadvantages, to accomplish this by extending the Base Case? Or, is there a better ...

Grace period for the bounty award on that question. The only existing answer is from Matthew Sontum. It has no votes.
 
@PaulWhite in this case it is correct, for sure
 
> The current answers do not contain enough detail.
I guess I'll just let it expire then.
 
@PaulWhite @McNets should answer it brilliantly, attracting 28 upvotes and the bounty
 
Nah I'd never give him a bounty.
 
I won???
I had loosed my faith after Evan's answer
 
4:05 PM
@McNets another 150 is up for grabs, run, run!
 
@dezso haha, don't kidding me
maybe tonight ;)
 
@McNets The bounty award is completely at the discretion of the bounty setter.
If I set a bounty to draw attention, I will often (but not always) award it to the highest scoring answer at the time the bounty expires.
 
4:43 PM
@PaulWhite crystal clear, thanks
 
5:12 PM
I've discovered the best way to find bugs in dbfiddle is to use it to answer questions here :)
 
1
A: Database design: Normalizing a "(many-to-many)-to-many" relationship

Jack Douglas Option 1 *This doesn't seem like a great idea to me, because it complicates the SQL to select all properties applied to a feature… It does not necessarily complicate query SQL (see conclusion below). …and doesn't readily scale to more conditions… It scales readily to more conditions,...

 
@PaulWhite wow, interesting details.
 
5:37 PM
Erwin's answers are just as thorough on meta as main: meta.dba.stackexchange.com/a/2708/1396
 
6:07 PM
@PaulWhite M:M:M suggests OP has found a 4NF problem. In which case it needs to break into two M:M relationships.
 
@ConcernedOfTunbridgeWells quick, you've got about 18 hours!
 
@McNets it was a good answer. it's the traditional answer. you got it. it wouldn't be the answer I employ w/ PostgreSQL but it's a valid way to get the job done.
 
6:29 PM
@JackDouglas @ConcernedOfTunbridgeWells I have been known to add a second bounty for exceptional answers in case time runs out.
@JackDouglas So do you feel mean for proposing to take his tag away now? 😋
 
worse: meanie ;)
 
hey @PaulWhite, what book would you recommend to learn how to read execution plans in SQL Server?
 
Is it difficult to update the default text that shows up for tags when asking a question? imgur.com/a/GxAYm
 
@PaulWhite :p
 
6:59 PM
@Lamak I'm not aware of a good one
@JoeObbish moderately difficult. Involves higher powers. The really difficult part would be getting consensus for the new text on meta.
 
@Lamak I haven't looked at it myself, but maybe try this one? red-gate.com/library/sql-server-execution-plans-2nd-edition
 
@PaulWhite then write one man, I'll take 30% of profit for giving you the idea
 
it's free
 
@EvanCarroll Thanks a lot.
 
@JoeObbish thanks!!
 
7:03 PM
@Lamak Ha. You probably think books make money eh
 
well....not every book....but a @PaulWhite written one might
specially if you add the Pinal Dave's autograph that @TomV is gonna give you
 
So close to getting kicked
 
aaw
 
😁
 
"A foreword from Pinal Dave"
3
 
7:07 PM
Have a star
 
@PaulWhite see?, people is on board with this
 
sigh
 
was that a resignation sigh?
 
Multipurpose
@JoeObbish and worth every penny
 
lol
 
7:12 PM
Um, I get a certain vibe about The Authority here. Is there a backstory I'm missing?
 
It's not always filled with the best advice in the world.
 
@Forrest not really a backstory. It's more just simple banter because he tends to post very simplistic posts
and having a ton of views
and that it never comes to my mind when thinking about SQL Server authorities
 
So it's kinda ironic
 
and kinda sad
 
Yes. His heart's in the right place.
 
7:17 PM
Ahh, gotcha. That matches what I see. Quick answers came from his site when I was starting out, but explanations to build understanding come from other people like Aaron.
 
@PaulWhite have you seen his x-rays?
 
Oh no Aaron's an idiot
I jest!
 
can moderators see who stars a message? asking for a friend
6
 
Joe wins three Internets
 
thank you
the earlier conversation reminds me of an upcoming sql saturday presentation
the author claims that there are minimal logging benefits for TF 610 even with full recovery model
initial reaction is "this guy has no idea what he's talking about so I'm not going to that one"
but then I think "maybe I don't know what I'm talking about"
 
7:22 PM
That's an interesting perspective.
 
so I don't know if I should go or not
 
@JoeObbish and maybe, neither of you have any idea
 
Who is it presenting? Unless it's Sunil or one of the Bobs, I'd be very sceptical
 
Yeah but just because I don't know his name doesn't mean that he's wrong...
 
@JoeObbish it doesn't?
> As a Visual Studio champ, Simon contributed to fixing a few stored procedures in Microsoft Release Management and resolved critical blocking and performance issues.
I don't know why, but that sentence sounds so weird to me
 
7:27 PM
@JoeObbish what's more, if it is the only presentation on the topic, it is automatically correct
 
@Lamak Depends on your philosophy I guess. Let's say that you think you're really sure of something. You could be eager to hear evidence to the contrary because it would be very high value to you to be proven wrong.
On the other hand, it's more likely to be a waste of your time.
 
@JoeObbish ah, sorry, I assumed you would know I was just messing around
 
@JoeObbish Visual Studio champ. Yeah I think I'd give that a miss. Except for entertainment or curiosity value.
 
@Lamak Not at all. I think it's an interesting thing to think about
I try to be more like the first option, but of course there isn't enough time to listen to everyone's crazy ideas
 
@PaulWhite yeah, that whole sentence reads so off to me
 
7:30 PM
Well, if I ask a question next week along the lines of "What are the benefits of TF 610 with full recovery model?" you'll know what happened
To be the honest the main reason I'm going to the event is to hear Adam Machanic at the pre-con the day before
extremely excited for that
 
Which one is he doing? Sorry on mobile too hard to check
 
@PaulWhite Tuning Your Biggest Queries
 
Thanks
Yes I think you'll enjoy that.
 
8:09 PM
@PaulWhite you mean SQLSaturday presentations are not peer-reviewed prior to presentation?
I don't know the ins-and-outs of SQL Saturday, only having attended one.
 
@MaxVernon Correct. But then not even PASS summit is reviewed for actual content before presentation. Aside from the slide deck confirming to the rules.
 
@PaulWhite interesting. You'd think that would be mandatory at PASS. Also, I guess that would be a great selling point if you presenting. "peer-reviewed by Paul White" would probably go a long way.
whereas "peer reviewed by Max Vernon" might get you laughed out of the room. ;-)
 
@MaxVernon "peer-reviewed by Paul White" in big letters, and a very small disclaimer at the end:"* he thought it was crap"
 
@Lamak lol
 
@MaxVernon Not if the talk was on replication or one of a hundred areas of SQL Server I have no clue about.
 
8:16 PM
@PaulWhite true enough, I suppose.
 
Besides, the slides could be fine, but on the actual day they could talk about anything between the slides, or not use them at all.
 
@PaulWhite or we could just use the "peer-reviewed by Paul White" phrase and you would never know
 
I'm sure that there's more than one guy named "Paul White"
just find a cooperative one
 
There is that side to it as well :)
I'm going to change my name to the result of SELECT NEWID()
You may now address me as Mr BA58C248-924B-47FA-8F37-8B0351F4BD3D
4
 
@PaulWhite unique, but not very sexy!
 
8:22 PM
And "Paul White" is ?!?!
 
@PaulWhite hey, you're Mr. White , which is trés cool, where I come from.
My name on the other hand is also the name of a young homosexual singer based in New York.
* not that there is anything wrong with that
 
Oh I heard New York was terrible
 
@MaxVernon being young?
 
@Lamak yes, and based in New York, as Paul noted.
:-)
 
@JoeObbish After Adam's talk you'll be rewriting your entire code base to use parallel nested loops, apply, unsafe clr functions with begin thread affinity, and doing crazy things with dynamic SQL. Crazy, unsafe stuff that might break with the next CU, but somehow never does, and can perform extremely well. He's also entertaining to watch.
2
Maybe not for whole day ha ha ah ah ha
 
8:27 PM
@MaxVernon I think you meant, as BA58C248 noted
(for friends)
 
@Lamak oooops, yes
 
@Lamak Not unique enough. BA58C248-924B-47FA-8F37-8B0351F4BD3D please.
That's not going to stay on my clipboard forever is it.
 
@PaulWhite it was a short name for friends, though. But I guess you are right
 
@PaulWhite lol, pinned for preservation
 
Right I'm out of here for a bit. Look after the place.
 
8:30 PM
aye, aye, captain!
 
@MaxVernon you meant boss
 
Well try not to burn it down, at least ;)
bye
 
bye
 
@Lamak yep!
 
8:58 PM
@PaulWhite by ?!?!, do you mean the Postgres operator?
 
^^^ this young man just added SQL Server 2014 to dbfiddle :)
 
@JackDouglas you are younger than I thought
3
 
why thank you!
 
it's the truth...I think
 
9:20 PM
@MaxVernon regarding your answer about the fractional seconds. So time is stored as (kind of) an integer that denotes how many 1/300ths of a second it has?
 
exactly
 
fractal seconds. sounds like a conspiracy theory
@PaulWhite i concur
 
9:41 PM
@JackDouglas I find it impossible to work in such an orderly space
also, what is stored in the cabinet? Spare table parts for dbfiddle?
 
@MaxVernon then why do you say that it couldn't store higher accuracy?
 
@ypercubeᵀᴹ yah, I just realized that my statement that 4 bytes is not enough to enable more accuracy is incorrect.
 
86400 * 300 = 25920000 while 2^32 = 4294967296
 
I'm at a loss to explain why that is the accuracy limit. I would guess that when sybase was developing the datetime data type 3 milliseconds was about as much accuracy as you could get from a 25Mhz processor, or some such thing.
 
@MaxVernon You don't have to. That's a different question!
7
Q: Why SQL Server DATETIME type saves time in ticks of 1/300 of a sec?

StasSQLServer datetime format is stored as 8 bytes where the first four bytes are number of days since Jan 1, 1900 and the other four bytes are number of ticks since midnight. And the tick is 1/300 of the second. I'm wondering why is that? Where is that 1/300 came from? There must be some historic r...

but I don't buy that either - even with the Celko reference.
 
9:54 PM
@ypercubeᵀᴹ thanks for finding that!
 
10:46 PM
@dezso I will upload another photo at some point so you can read all the labels ;)
 
11:36 PM
Who wants to look at this... dba.stackexchange.com/posts/166374/revisions
Edit war.
 
@EvanCarroll I was wondering why you changed the name back to foo. Was it just the preference to "create table as .." vs "create table / insert"?
Otherwise, the original post had tmp as the table name.
 
No, First, I added the CTAS before. I never change DDL for CTAS, and I don't think we should be doing the opposite either. Second, the CTAS I had was arguably not right as it wasn't a timestamp, but it wasn't a date either. Yours makes the question impossible. Sure it's just a typo, but why did you make the edit. The edit also mislead Erwin in his answer. lastly, your preference over tmp is a preference that I'm ok with in the future, but it breaks my answer -- we were already using foo.
(actually I'd prefer foo slightly as tmp for a non-TEMPORARY table is kind of weird).
Meta-syntactic variables abound, I don't care about the variable name though I don't think it's feature to call it temporary when it's not temporary. And, I do think we should slightly prefer CTAS as it's the standard method of creating demo-tables, but we shouldn't fight about this or pick one of the other. When you beat me to the punch, I'm glad to accept DDL.
I didn't even see that tmp thing. dba.stackexchange.com/revisions/… He did have it in a query though, you're right on that.
mislead Erwin in his answer with (NOT NULL)
 
@EvanCarroll why does i tmake it impossible?
 
Because the groups have time information, and when you created the ddl to use dates you casted timestamp to date on input (losing the necessary time).
 
@EvanCarroll I casted to date?
Check again. Your edit had no types.
I used timestamp (and forgot the int by mistake.
And CTAS should die in fire but OK. I don't go and edit the various CTAS I see all over the place.
 
11:49 PM
you're right, on both accounts, the original DDL (not mine) didn't work I'm not sure how mine got to date.
 
@EvanCarroll and the foo -> tmp did not really break any answer. The other answers - before yours - were using other names.
No problem there.
 
It seems, on a quick look, that multiple people were trying to make helpful edits at roughly the same time. I have locked the post while we all agree what should be done.
 
A different name makes no difference
 
The foo->tmp broke my answer and erwins
 
Your answer: 22:58:44
 
11:54 PM
Well quite, but the timings don't really matter in the end. I'm surely not the only person to take a few minutes to write an answer an not notice that the question has been edited in the meantime.
So what do you all think should happen here? @ypercubeᵀᴹ @EvanCarroll
Given that the original question gave no table name, data types, or nullability information.
 
I'm cool with whatever. I was wrong about both the edit having the wrong type, AND the tmp. It was in fact called tmp in the OP's query, so I'm cool with my name of foo getting renamed to tmp, in fact @ypercubeᵀᴹ did the right thing there. I don't much care about the NOT NULL dispute, between Erwin and @ypercubeᵀᴹ either. I have no idea why that matters.
 
The original question had column names - without types (although we could guess). The table's name was in a query but not very visible as it wasn't formatted.
Yeah, i should have probably not added the NOT NULL in the first place.
 
Ah right I had missed the table name in the unformatted query. Thanks.
 
I don't know if it matters for the answers
 
@PaulWhite so did I, @ypercubeᵀᴹ got it though and he was right for it.
I still want to see why Erwin feels his answer is different -- I almost think he copy pasted it, but I'm not touching that question or answer again.
 
11:58 PM
Let me propose something.
How about we revert the question to its original form, just with the code formatted. Then, the answers can make whatever assumptions they like about types, names, and nulls.
To be clear: I'm strongly of the view that all the edits here were helpful
We just need to resolve the situation given the overlaps.
 

« first day (2253 days earlier)      last day (2621 days later) »