« first day (1683 days earlier)      last day (3188 days later) » 

12:27 AM
@PaulWhite @Phrancis I also liked Kim Tripp's examples: sqlskills.com/blogs/kimberly/high-performance-procedures
 
Sure, it's a natural optimization.
 
 
2 hours later…
2:36 AM
@PaulWhite Yes, that would be a good way to put it, SQL coding "best practices"
 
 
5 hours later…
7:47 AM
morning
 
morning
 
8:02 AM
@PaulWhite do you ever sleep? :)
 
zzzz
 
8:14 AM
Do I understand the term "term" in this question correctly as "one of the periods into which a year is divided at school, college, or university"?
0
Q: How can i enforce data integrity in this setup?

g_bI have these tables: |-------------tblSchool -------------| | | | | tblSchoolYear tblTerm | + SchoolID | + SchoolID | | | ...

Or should I ask the OP to be sure?
 
@AndriyM Yes.
 
@PaulWhite Thanks you.
 
8:49 AM
I tried alot but am not getting any proper answer from my mind plz help — maira khan 4 hours ago
Somehow I am not convinced
 
9:05 AM
I would have a hard time with that assignment. What does even "non-clustered indexing" mean? Is it a euphemism for a heap?
 
@MikaelEriksson some assignments in college/univ. are like that
I had an exam in analytic geometry in the univ. where we had to prove that certain equations would produce homocentric cycles.
After 2 hours, I managed to prove that it was a spiral.
I obviously failed the test
(3 hours, and 3 more proofs to do, I was too frustrated to even try)
 
@ypercube He he, you just made me feel like the first time a read a Paul White blog post. O-0.
I guess you were right and they were wrong right?
 
Yes.
The excuse when I confronted the guy who had made the test, was like "hey, it's almost the same thing" or like that. More frustration.
 
@ypercube trying to figure out what a homocentric cycle is, no luck so far. Sounds like it kind of connects with it self on the "other" side where spirals hm... does not.
 
Cycles with same center.
It may not even be a word, I'm "translating" from the grrek term
@MikaelEriksson concentric is the right term
 
9:22 AM
Ahhh, that was more google friendly :) Definitely not almost a spiral.
Perhaps if viewed from afar where the lines start to became blurry.
 
Yeah, not the kind of answer you expect from a geometry professor.
0
Q: How do SQL Server perfom lock when using CROSS APPLY?

Serge ProfafilecebookThe best way I think I can ask my question is by starting with an example. Imagine these two queries : SELECT CAR.SerialNumber, TIRE.SerialNumber FROM dbo.tCar AS CAR INNER JOIN dbo.tTire AS TIRE ON ( TIRE.CarID = CAR.ID) WHERE CAR.Brand = 'Jaguar' and SELECT CAR.SerialNumber, TIRE.SerialNu...

No idea how this can be answered
 
Yea I saw that. For the example given there will be no difference at all because the plan will be the same for both queries.
 
@ConcernedOfTunbridgeWells apparently I missed your drinkies invite as I was on holiday. I'm kind of around on the 28th, but on one of Paul Randal's training courses that week in London. In theory it should finish on time!
 
@PaulWhite orchid textile is a large organisation = same prespam as yesterday
remember the NAA?
it's the same text
 
@MarkSinkinson We were considering the 21st instead (or some of the previous days that week)
 
9:30 AM
@TomV Yes I thought I'd seen it before. Hm, now where was that...
 
the post where I asked is this spam? then i flagged it as NAA
then you said it was probably prespam nonsence
so maybe it wasn't spam yesterday but a question posted as an answer, or maybe it's prespam again
 
Yes I do recall, I'm just trying to find the darn thing
 
@ypercube Fair enough. I think the 21st works for me
 
not sure if you can still see that with your diamond status
 
@TomV of course he can. and al 20k+ users
 
9:33 AM
@TomV Yes thanks very much for the help there :)
 
So, it was probably not spam? They had just posted the homework question as an answer?
 
@ypercube I guess
 
Just wait until assignment #3 comes out :)
 
10:17 AM
What is the benefit from flipping? — ypercube 2 mins ago
Anyone knows what's point of that part in Kejser's answer?
 
10:46 AM
@ypercube It will prevent the generated sequence number from being ever increasing and that will give you the same benefits with the sequence as you have with a random GUID in certain scenarios.
12
A: Indexing a PK GUID in SQL Server 2012

Thomas KejserThere is nothing wrong with GUID as keys and clusters in an OLTP system (unless you have a LOT of indexes on the table that suffer from the increased size of the cluster). As a matter of fact, they are much more scalable than IDENTITY columns. There is a widespread belief that GUID are a great p...

 
@MikaelEriksson thnx. So it removes the congestion from one place (the end) all over the index.
 
11:07 AM
Monking
Anyone got time to look at a demo cursor? It times out on sqlfiddle and SEDE both, so I'm wondering if I'm doing something wrong. Haven't got a chance to test it on live SQL system... pastebin.com/bu52KcV6
First time doing a cursor, I followed MSDN directives to the letter, AFAIK
(I commented out the cursor logic to make sure it works, which it does without it)
 
you forgot to fetch data inside the cursor
 
@Phrancis Looks like you are missing a fetch next statement in the while loop
 
^^^
 
your while is always on :)
 
11:15 AM
and that would take a while
 
Ah, infinite loop eh?
Should while @@fetch_status = 0 be right after I open the cursor and before I fetch?
(instead of after fetch)
or wait... let me check MSDN again lol
 
declare - open - fetch - while - do stuff - fetch again - end while - close - deallocate
2
 
ahhhh
 
Also have a look at Aaron's blog about cursor options: sqlperformance.com/2012/09/t-sql-queries/cursor-options
 
@yper, it's curser, not cursor :)
 
11:22 AM
Ah, much better :)
 
Are we moving to SEDE in preference to SQLFiddle?
 
SEDE seems less buggy, at least to me
 
Indeed. For SQL Server, anyway.
I was just wondering out loud.
 
OK. Just tried on fiddle, actually worked better lol. I just hate the GUI I think
 
By the way, I can't help but mention that each cursor option has its place. As with everything, you need to learn the differences, and when each is optimal.
DYNAMIC cursors are best for some tasks, for example, though there is almost universal disdain for them.
 
11:27 AM
I hear cursors in general should be avoided when possible, that's about as far as I got; but this task I've been working on looks like it will require them, or some other form of loop
 
Sometimes a cursor is what you need. They're not in the product just to hurt people for fun.
 
TTGTW, back in a bit
(@PaulWhite that's "Time To Go To Work")
 
Thank you so much :)
 
@PaulWhite Just had a "Hanlon" moment there?
 
@MikaelEriksson Ha ha, no. Cursors, even T-SQL cursors, have valid and optimal use cases. People can be dumb about using them, no doubt.
 
11:37 AM
I know. I do read your blog posts you know :)
 
@MikaelEriksson You might have stopped! ;)
Besides I say stuff aimed at the world in general even when I @reply
I know it's annoying but I don't care.
 
@PaulWhite Not yet. Still waiting for the post on XQuery performance optimizations.
 
Hey Paul.
 
Hey Michael.
 
How are you settling into your new bling?
And congratulations. I don't think we (the community) could have lost in that election, whetever the outcome.
 
11:42 AM
It's actually pretty much as I expected. Fear of doing stuff wrong, feeling awkward being the newbie.
@MichaelGreen Thanks. And yes, I think that's true.
It is an exciting new challenge though. And that's not just an empty soundbite, either.
I debated long and hard with myself about the relative merits of the magic diamond.
I still think there are others who would have made an more natural an easier fit as new mod, but I'll give it my best.
 
Did you have a good idea of the extra tasks & tools that would come your way, should you win?
 
@MichaelGreen Yes re:tasks and volume; not so much re: tools.
Also, I've never read so much FAQ and meta :)
@AndriyM Nice work.
 
Interesting. Thanks. Someday I'll systematically work my way through Meta. Just not enough hours to do everything, though.
 
Isn't that the truth.
BTW I nearly stopped writing my answer to that apply/locks question when your answer appeared :)
 
11:58 AM
Any mods around?
What to do with cross posts?
0
Q: find columns with different values for different rows in same table

user2293813I have a requirement to find the columns (with values) from a table which have different value for different rows. For example, my table MARC has more than 200 fields with key as werks (plant). I have a reference plant and most of the entries in marc have values coming from the reference plant. S...

-1
Q: find columns with different values for different rows in same table

user2293813I have a requirement to find the columns (with values) from a table which have different value for different rows. For e.g. My table MARC has more than 200 fields with key as werks (plant). I have a reference plant and most of the entries in marc have values coming from the reference plant. So us...

 
@MikaelEriksson Thanks. That's up next in my queue.
 
@Paul. Thanks. It was a bit difficult to know just how to pitch the answer. There's what was asked, what he probably meant, and what he actually needs to know. In the end I think we said much the same, only you had references and I had a six inch touch screen in one hand and a simpering child in the other!
 
I was verbose, you were precise? ;) I went through the same thought process about the pitch. I think they're complimentary actually, hence didn't throw mine away.
 
Is this a more than 30-year old table that you cannot change now? — Andriy M 36 secs ago
@PaulWhite Thanks. Can't help it. You've been leading me by example all this week.
(What exactly do you mean, though?)
 
Comment flag.
 
12:09 PM
Ah, that one, yes.
 
@MikaelEriksson Fixed. In general, I prefer a flag (as other...) with any thoughts you have on which is the better home. It's usually easier for us to coordinate with the other site than go through migration, closing, an merging.
 
@PaulWhite Sure. "Flag as other" is a good answer to my question. Thanks.
 
12:25 PM
Good night everyone. Sleep well.
 
@MichaelGreen Thanks for the chat, Michael.
 
 
1 hour later…
1:38 PM
@MarkSinkinson Considering moving it a week forward to the 21st to dodge tube strikes. Will post something soon.
@PaulWhite Yeah, people confuse us for Australians all the time ...
 
2:38 PM
@MichaelGreen Huh?
I also received a notification in my inbox SE.
 
@PaulVargas heh, it was for the White
probably a chat fock-up
 
@Marian Ha! :) There is no problem. Nevertheless, I had entered the chat, I had not taken part.
 
@PaulVargas When you have been in the chat room recently, you get notified when one mentions your name with @
like @Paul
 
Oi! (I got pinged for that)
:)
 
But there is an issue with names starting the same, like PaulWhite, PaulVargas
@PaulWhite I guess you both got pinged!
 
2:44 PM
I always hit tab. Seems to work.
 
yeah, if you call @Paul .. they all come
:D
 
@ypercube I just got pinged for the very last one by Mr Cube.
 
@Marian Humm... OK. :-P
 
Oh hang on LOL I see what you mean.
As you were.
 
yes. I was trying to exaplin to paulvargas why he got pinged.
Michael had used @ Paul (only) to ping you.
 
2:45 PM
@PaulWhite Are you a Java programmer?
 
@PaulVargas No. Why do you ask?
 
@PaulVargas It's good that our mod is not evil. You'd have to face consequences otherwise.
 
@PaulWhite I don't know.
But I'm a Java programmer.
 
I don't think chat ping discriminates :)
 
here's the proof @Paul!
:P
 
2:48 PM
Goodness me people!
I suppose I could just mute my volume and ignore you all ;)
 
sowwy :)
 
@PaulWhite or freeze the room. And then keep pinging us while we can't talk ;)
 
@Marian You Talking To Me?
 
vision + skill + incentive + people - action plan == false start http://t.co/bihQpRSQ8g
 
@ypercube Ha ha ha evilcube.
 
2:50 PM
talking to anyone who'd listen @PaulVargas :)
 
This has been very educational. Unfortunately, I have to work.
 
This room was placed in timeout for 30 seconds; the topic of this room is "General on- and off-site discussion for dba.stackexchange.com"; - conversation should be limited to that topic.
Oh that's awesome.
 
That was tense...
 
Wasn't it just?
Automatic official message and everything.
 
Very nice.
 
2:53 PM
And yes very educational.
Resume silliness.
2
 
Phew. Thought we're forced to act professionally for the rest of our lives.
 
Like we'd know how.
 
What are you doing. My phone started a count down on me.
And then I saw it was only the heap tab.
 
@MikaelEriksson Timeout.
 
2:55 PM
Wondered what it did.
We found out!
 
It was exiting.
 
Our finest 30 seconds.
 
Nothing dumb was said
 
Exactly.
 
I missed an opportunity to say something during a room timeout?
 
2:58 PM
@TimStone You mean you'd be able to?
 
@TimStone We could do it again, but it wouldn't be the same :(
 
Wouldn't be special
 
Unless Tim has another awesome trick we've never seen...
 
@AndriyM MOD ABUSE
 
2 days ago, by Paul White
With great power comes a great lack of responsibility.
 
3:01 PM
There are the chat room mods and then the site mods and then super mods. Where does it end?
 
Dev mods?
 
"It does not, there are mods all the way".'
 
Mums of dev mods?
 
@MikaelEriksson It's mods all the way down
 
Ah yes Pratchett.
 
3:02 PM
+1 @TimStone and @PaulWhite
 
Ah, you were one step ahead of me ;)
 
This was fun. I'm out.
 
See ya
 
it's a bit funny when a rather silly question results in 4 almost identical answers.
0
Q: Incorrect total using SUM of DATEDiff results

Mario MartinWhen i run a few DateDiff(SECOND, value1, value2) it returns a lists of values 93, 185, 1879 which totals 2157 sum with the calc and with SUM() However, when i use DateDiff(SECOND, firstValue1, lastValue2) returned 2476 A example of the problem is: declare @testTable table ( DateD float ...

Oh, 5 now
 
Equally fast guns in the West.
One died :(
 
3:15 PM
Collateral damage?
 
@ypercube Six if you count the answer posted as a comment ;)
 
@PaulWhite what comment?
 
Not sure. Might have undergone catastrophic gravitational collapse under the weight.
 
I may have found the most useless peice of code ever written.
 
@ypercube Yours :)
 
3:17 PM
CREATE TABLE #Status
	(
	[Arrow Status] VARCHAR(30) NOT NULL,
	[LPO Status] VARCHAR(30) NOT NULL
	)

	INSERT INTO #Status
		(
		[Arrow Status],
		[LPO Status]

		)
	VALUES	('In Arrow (Open Defi)', 'In LPO (Open Task)'),
			('Arrow Discrepancy (No Defi)', 'LPO Discrepancy (No Task)' )

	SELECT [Arrow Status],[LPO Status]
	FROM #Status WITH (NOLOCK)
	DROP TABLE #Status
That's standalone. It's all this does.......
 
Super!
 
Good they had NOLOCK
3
 
@ypercube Bwahahahaha! I'm so numb to nolock I didn't even notice it.
 
in case someone else was trying to read from the table at the same time
 
Aaron has ... you'll never guess
Kinda weird that sum & datediff question has no votes, up, down, close, nothing. Like we're all watching it, wondering what it will do next.
 
3:25 PM
I just sent the creator an email asking what the point of this was.
@PaulWhite haven't seen it.
 
15 mins ago, by ypercube
0
Q: Incorrect total using SUM of DATEDiff results

Mario MartinWhen i run a few DateDiff(SECOND, value1, value2) it returns a lists of values 93, 185, 1879 which totals 2157 sum with the calc and with SUM() However, when i use DateDiff(SECOND, firstValue1, lastValue2) returned 2476 A example of the problem is: declare @testTable table ( DateD float ...

The casing in the title bugs me.
It's like their key gave up after a while
 
Would it be better with SUM, DATEDIFF or Sum, DateDiff ?
or Sum, Datediff?
 
3:41 PM
They're all better :)
I've been sat here looking at it for ages. It's hypnotic.
"Why?"
 
3:59 PM
Gah. Nope. It gives me a headache just looking at it.
 
Well that explains my headache at least.
 
Awful
 
Did you not see that I removed mine.
 
Funny
 
 
1 hour later…
5:30 PM
> put on hold as off-topic by bluefeet♦ 57 mins ago
and she says she is not a mod any more ... dba.stackexchange.com/questions/111086/…
 
Is it possible to explicitly specify fields when calling a proc/udf in SQL Server? I know in Postgres you can do something like select udf_search_name(first_name := 'John', last_name := 'Doe'); but what about TSQL?
 
@Phrancis I think only with stored procedures, not with UDFs
 
Do you know what the syntax is like? Or what to look for on MSDN?
 
@ypercube Well I was never a mod on DBA
 
Postgres has only one type: functions (and can be used as functions or procedures)
 
5:36 PM
Right
 
I hesitate to say it but...
Aaron has a post about that
Well only sort of, but I couldn't pass it up.
 
Looks good enough, just what I was looking for
 
Nah you were looking for this
@Phrancis @ypercube Named parameters work for procedures and scalar functions.
 
> A stored procedure can have as many as 2100 parameters, with each parameter having a name, data type, direction, and default value.
^^ HOLY CARP
 
Yep. Doesn't say it's a good idea though.
 
5:41 PM
You guys are really awesome. I'm so glad I found this DBA site.
 
Wait til you get the invoice at the end of the month.
3
 
lol
 
Right I'm out of here for a bit. Have fun!
 
5
Q: Which site is best for code reviews of queries?

PhrancisImagine a junior database developer / DBA that may not have an avenue to get their SQL code reviewed for best practices and such as they are learning the ropes. There is of course the Code Review Stack Exchange (CR.SE) site, which can and will review SQL if it is posted and falls within the site ...

 
5:57 PM
I wonder if CR people will have anything to say; guess this must indeed be a new one for DBA, no response after 24 hours
 
6:12 PM
@bluefeet now your powers are greater than ever!
 
 
2 hours later…
Kin
8:39 PM
 
 
1 hour later…
9:45 PM
So, I've reached a point where I am kind of stuck...
 
@Kin tempted to downvote the answer there
 
Is there a way to build the object path in the FROM clause dynamically, with the understanding that I've got 30-some [server : database] pairs I need to loop through for error checking?
Or some other way, whatever; but considering that the only things that would need to change during my cursor would be the @server and @database vars, as long as I can build the path from those?
 
I don't see why you nee a cursor here.
 
I'm all ears
Though, the cursor is not what bugs me
 
It seems you need a loop that iterates over a list of dbs and executes one statement or 2 per db.
 
9:54 PM
Yeah that's the idea
 
So look for how to build dynamic SQL. Cirsors may br needed or not, not sure.
 
OK. But, regardless, is it feasible using dynamic SQL to build the table object path using string values?
 
I think so. Cant type well or search, I'm on the phone
 
Hmmm. SQLCMD variables, now that looks promising
 
You should make a question on the site, if you cant figure it out. Aaron has answered
 
10:00 PM
Right
 
lots of dynamic sql questipns. And others of course.
 
OK I will
TTQW
 

« first day (1683 days earlier)      last day (3188 days later) »