« first day (1308 days earlier)      last day (3568 days later) » 
04:00 - 20:0020:00 - 23:00

4:28 AM
0
Q: Identity Column Issue in SQL Server 2012 Express

JeetenI am setting Identity column with primary key to one column named UserId. So, it will auto increment. It was working fine in my SQL Server 2008 R2. But before sometime, I upgraded it to SQL Server 2012. It was working fine but don't know what is the wrong, It has suddenly increased number from 1...

@AaronBertrand there should be a vote to close reason with a link to your blog.
 
 
2 hours later…
6:01 AM
You removed a paragraph and suddenly your question stopped making any sense. — Andriy M 5 mins ago
 
6:32 AM
-1
A: Identity Column Issue in SQL Server 2012 Express

DiMachUnexpected identity increment is good indicator of hidden problems. Let's consider: "ROLLBACK TRANSACTION" always results it. Try following: CREATE TABLE table1 (id int identity(1,1), val int) INSERT INTO table1 (val) VALUES (1) SELECT * FROM table1 -- one row, id = 1 BEGIN TRANSACTION INSE...

are there any hidden problems with identity?
 
6:49 AM
0
Q: How to decode OLAP Query?

RamI am totally fresher to OLAP server. i have a OLAP query that is working fine, i just want to know, which tables are linked to send the result and how(i mean with which joins). Here is query. WITH MEMBER [Measures].[ThisYearMonthToDate] AS 'Sum({[Time].[All Time].[2013]. [Q1].[January],[Time].[A...

Say what?
 
@Marian He probably didn't mean hidden problems with identity, rather with design/business logic/code/whatever.
Although he might still be wrong calling it wrong. :)
 
 
1 hour later…
8:12 AM
@AndriyM might be, but reading his code sample looks to me like he's saying the identity value should be rolled back/cleaned up along with his transaction.
we'll see if he comments on it, I might be wrong.
 
I've swapped them round so indexed-view is now a synonym for materialized-view. The wiki now makes no sense of course but no doubt someone will fix that up. — Jack Douglas ♦ 7 secs ago
^^^ we can change our minds on this if we want to - only about half a dozen have voted so if you think this is the wrong solution please chip in.
 
9:17 AM
A program allowed to create databases; should that even be allowed?
1
Q: How to create a Microsoft SQL Server database by using ADO.NET?

RashidHow to create a Microsoft SQL Server database by using ADO.NET and Visual C# .NET programmatically? I need to create databases programmatically. I use this code but after creating database, I cannot add a table to this DB due to permission problem string str = "CREATE DATABASE MyDatabase ON PR...

 
@Twinkles Why not? It may not be the best idea but that depends on what their application is about, right?
 
9:39 AM
Dude, you msut really learn reading.The error is an OS LEVEL access denied error. NHothing in SQL will fix that ever. Start looking at your file system permissions for the place you create the database file in. — TomTom 28 mins ago
awwww, how cute.. :)
but he really msut learn writing :D
 
gbn
9:54 AM
Muphry's law is an adage that states that when a person criticises another's editing or proofreading, there will be a mistake of a similar kind in that criticism. The name is a deliberate misspelling of Murphy's law. Similar laws have also been coined, usually in the context of online communication, under names including Skitt's Law, Hartman's Law of Prescriptivist Retaliation (or The Law of Prescriptive Retaliation), The Iron Law of Nitpicking, and McKean's Law. Further variations state that flaws in a printed or published work will only be discovered after it is printed and not during proofreading...
2
 
10:53 AM
@gbn nice :).
how's life in sunny Malta?
enjoy working with Swedes?
 
gbn
11:07 AM
@Marian Still nice
I'm busy these days in my private life too, so not here much
and you? Still in Romania, or have you been lured to the UK too?
Or I can check LinkedIn :)
 
11:32 AM
@gbn :-) heh, been lured by @Mark to work for him, so everything is interesting. Don't have many news, except moving to Bucharest where it's warmer than I'd prefer.
 
gbn
@Marian Warmer now? Or generally? I don't know much about Romania
 
@gbn no, just here it's warmer than my old city. Didn't really have 35+ in the summer in my old city, but now.. we have 3 days with 34-35-36 :D. And we don't have a beach, like you do.
 
gbn
@Marian Malta is an over sized ash tray
Some beaches, mostly rocks.
 
@gbn ah, thought you're all sandy, like in @PaulWhite's vacation pictures
 
gbn
@Marian There is probably more sand dumped from the southerly winds from the Sahara, than exists on the beaches here
 
11:45 AM
eh :). How's life lately?
 
 
1 hour later…
12:50 PM
I closed this (5th vote) as the last edit by OP, made the question worse than it was:
-4
Q: Aggregate Functions for TempTable

Majid Fazeli NasabALTER PROC [dbo].[SpProfitInDay3] AS BEGIN ------------------------------------------------------------------------------------------------------ CREATE TABLE #TempTableToday (DetailAccountId bigint,MandehToday bigint,soodHesab decimal(18,6),LastDate datetime); CREATE TABLE #TempTableMinMand...

If they edit to a meaningful question, we can reopen I guess.
 
 
2 hours later…
2:24 PM
trying to debug c# when you haven't worked with c# in about 3 years, really sucks
 
(async) this Roslyn!!!!!!!!!!!!!!!!!
 
uh, did the font here changed?, or was it because I finally restarted my computer?
 
chrome update?
 
maybe
 
Looks the same to me
 
2:29 PM
it's just me then. Probably a chrome update
it also changed the font in stackoverflow a little
@AaronBertrand are you back?
 
yay
 
but he's not:
 
His famous namian looks way cooler than mine
 
aaaaaand I'm lost
 
2:33 PM
I get the bach-back connection but not the bloody face guy
 
Oh, I assumed there was some famous "aaron bertrand"
There is a Bill Fellows actor who's totally ruined my SEO
Lamak's more famous version is a boxer
 
@AaronBertrand me too
 
I'm the uncultured swine who didn't recognize bach
 
@billinkc I didn't recognize it either, just read the link url
 
Were you aware of this fighter? He's got a totally sweet tattoo and by totally sweet, it's only rivaled by the stupid MMA fighter who has the sword on his sternum
 
2:38 PM
@billinkc left field. it's your source of origin
 
The grass out there is way more interesting.
 
@AaronBertrand looks like Subban is exiled to Montreal for a while now
 
@swasheck yeah I saw that What a bitch
Looking' for optimization in all the wrong places
Ah, one complication in that case. The update could theoretically span multiple tables (IE the @ StartDate is 31/12/2014 and @ EndDate is 14/01/2015). The Update will at max span 2 tables under these conditions, however. Would it be worth just adding a check for the YEAR(@ StartDate) <> YEAR(@ EndDate) and having it run the query once for each relevant table? — user3789393 12 mins ago
 
@billinkc no, I wasn't....
 
2:56 PM
STUPID DEVS.

weekend sql 2014 cognos batch cycle testing. except devs change the connection to point to the dev 2008 instance.
i'm so mad i could caps lock
 
You already did caps lock.
 
roight
@billinkc it's like the special colorado "grass", eh?
 
Nope, just your standard mix of clover, dandelions and rye/fescue
 
rye whiskey, rye whiskey, rye whiskey I cry, if I don't get rye whiskey I surely will die
 
3:11 PM
them good ol' boys were drinkin' whiskey 'n' rye
 
they are confused
0
Q: Select columns, but casting all columns of given type

im so confusedI need something that is the logical equivalent of select cast(* as numeric IF data_type='decimal') from table_name I didn't know how to do that, so i'm trying to reduce it into two steps: select * from table_name where data_type!='decimal' select cast(* as numeric) from table_name where dat...

question asked by
 
@bluefeet so
 
is this actually legal in the US?
 
JNK
@Lamak in the US most stuff is legal until someone complains or takes you to court.
We call it Freedumb
 
uh....well, this is something that shouldn't be
not heard that one before
 
JNK
3:25 PM
it's also a common excuse for people who aren't that bright. "It's a free country!"
I think they are likely to lose a court case over that one
not sure they can legally hold the wedding party responsible for things that people in the party do off-premises
 
well, apparently the wedding party signs a contract saying so, but (at least over here) not everything that is in a contract is legally enforced
there are abusive clauses that get dismissed
 
sqlfiddle is broken again :(
 
if you can't manage your image with good customer service, do it with extortion and draconian tactics
 
@Lamak check out the yelp reviews. reddit took care of it overnight
 
it cracks me up to hear ads for Reputation dot com on the radio. It basically says "have crappy review? We'll carpet bomb you with positive ones. Call now"
 
3:30 PM
yup, and they deserve it
@bluefeet it's working for me
 
awesome. 4 stars but hilarious reviews
 
@bluefeet i want a part of my donation back for each time it's down
 
@Lamak can't build a sql server schema
 
@bluefeet I just did (well, I used the sample fiddle, but it works)
 
@Lamak weird it's working now
i swear it was broken
:)
 
3:32 PM
yeah, I fixed
;-)
@Kermit anyway, can't see the reviews, yelp gives me this message:
> Sorry, you're not allowed to access this page
 
@Lamak you're probably in a terrorist country
 
@Kermit no, I'm not, shut up
 
@Lamak then i'm out of ideas
 
> This place is actually kind of decent. Derek, who was working the front desk, had pee stains on his trousers, but I'm only deducting one star because it wasn't immediately clear whether the pee was his or someone else's.

Plus the vintage bed clothes gave me herpes, but I'm looking at that as a positive because it's one more way of getting out of having sex with my husband while his dorky cousin Ben Reiter looks on.

There was also a super sweet chaise lounge in our room, though it smelled a touch musty. Every negative had a corresponding positive, and vice versa, hence three stars. Woul
 
3:33 PM
@swasheck yup, not allowed
@Kermit discrimination I say
 
> This business charges random fees. Buyer beware!!

If you stay at this hotel for a wedding, the bride is charged $500 per bad review.

Read the fine print!
"
If you have booked the Inn for a wedding or other type of event anywhere in the region and given us a deposit of any kind for guests to stay at USGH there will be a $500 fine that will be deducted from your deposit for every negative review of USGH placed on any internet site by anyone in your party and/or attending your wedding or event If you stay here to attend a wedding anywhere in the area and leave us a negative review on any i
i like this one
> Please pay the $500 for the 5 star review to my paypal account - thank you
 
JNK
rolled back
 
stupid xml
 
outer join - not left outer join, etc
-1
A: How to execute "IN" subquery only once

James CurranI'm just take a guess here, but this should work.... SELECT S.Style FROM Storage S outer join ValidStyles vs on S.Style = VS.ValidStyle WHERE vs.ValidStyle is null

 
@bluefeet I had just commented there
 
I see
won't this still execute for each row?
 
3:52 PM
it's also a bad question that assumes that it's better to rewrite the query
 
0
A: How to execute "IN" subquery only once

Tab AllemanSELECT Style FROM Storage s WHERE NOT EXISTS(SELECT * FROM ValidStyles vs WHERE vs.ValidStyle=s.Style)

 
@bluefeet But it's still the better way to do it. I think op is just confused about "every subquery ever is wrong"
 
JNK
IN should not execute once per row
NOT IN is pretty much the best way to do it to my knowledge
LEFT JOIN ends up a lot more expensive, especially on larger tables
 
@JNK yup, equivalent to NOT EXISTS if there are not NULLs
 
JNK
you also get dupes that way which people never think about
 
3:56 PM
NOT EXISTS is better because NOT IN has different behavior if the target column is nullable. Why use NOT EXISTS when it is nullable and NOT IN when it isn't?
 
why not?
 
@AaronBertrand I always use NOT EXISTS
 
Why ask why, drink bud dry?
 
JNK
@AaronBertrand its easier to write
NOT EXISTS lets you check multiple columns too
 
JNK
3:57 PM
I normally use EXISTS but it confuses some non-DB folks
 
It's easier to write DD than DAY, too, doesn't make it a good idea
 
@AaronBertrand I agree but the specific question is about performance. I don't see how all the answers are relevant. NOT EXISTS will not be magically more efficient than NOT IN, is it?
 
Also FWIW I have seen cases where LEFT JOIN outperforms NOT EXISTS
 
JNK
LEFT JOIN will outperform if you are joining on a CI column in the outer table normally
 
(and I totally agree, I use NOT EXISTS, too)
 
JNK
3:58 PM
otherwise NOT EXISTS is faster
 
@ypercube It could be, if the target column is nullable (hence my comment), since NOT IN could return all rows when really it should have only matched a small number)
 
JNK
I did a lot of testing on this at last job and that was only scenario I could find
 
Ok thnx.
 
JNK
Also if that CI is unique
and they are linked by a FK constraint
the FK one is a cheat tho
 
I'm not entirely sure I'm following where the disagreement is here.
 
4:02 PM
@JNK thank you
 
there does not exist disagreement in the above discussion. Absolutely not in there
4
 
@Zane just that you should sometimes use NOT IN to save a few keystrokes and not scare away non-DB folks. I disagree; see no reason to ever use NOT IN since it cannot be relied upon (you can't use it in all scenarios, and even where you can today, someone could change nullability of that column tomorrow).
So I don't understand why I'd write half my code with NOT IN (when the target column is not nullable), and the other half with NOT EXISTS (when it is nullable).
Consistency > keystrokes
 
Okay I follow now.
 
JNK
@AaronBertrand Do you mean "Consistency is more important than keystrokes"? It's unclear what that abbreviation means ;)
 
@billinkc I'm just glad you left joins out of it.
4
 
4:06 PM
<3
 
@JNK bwahaha
 
JNK
@AaronBertrand PS I finally got SS purchased and running
Performant Advisor is already helping
 
@JNK nice! Everything working ok so far?
thwap
 
JNK
yeah it's working well
I'm seeing some more gaps in our data which I think is from some stupid CLR stuff we have running
basically 3 of these jobs all end up running at the same time and the server seems to choke a bit
 
Yeah we definitely back off if the server is under extreme pressure; we don't want to make it worse.
But those gaps are telling you something useful, after all
 
JNK
4:20 PM
oh yes they are
 
0
Q: How to deploy SSIS package with XML config, using SQL agent

Andy HerdI wonder if anyone can help me with a question. Context I've created a database which needs a front end in MS Excel. When the user presses upload button I want it to start an SSIS package which moves the data into some tmp tables then runs a couple of stored procs to move the data into the corre...

Ewww.
 
worst design ever
Hmmm, that actually covers a lot of SSIS I see
 
The phrase "Excel front end" should never be spoken.
 
4:41 PM
@billinkc easier way to do this that I didn't think of?
0
A: Import blank cells as NULL in CSV

ZaneIn your data set all you need to do is add a derived column and set the value to this. YourColumn == "" ? NULL(DT_WSTR,50) : YourColumn You may also be able to check the box on the source that says keep null values to solve the issue.

 
I'm really glad SSIS chose to use its own proprietary naming scheme for data types, because DT_WSTR is so much easier to remember than NVARCHAR (and I like to be reminded I'm in a different place).
5
 
I can't tell whether they are exporting to CSV and want NULL in there or if it's pulling from file into SQL Server.
@AaronBertrand But you might be working with a source system that doesn't have nvarchar but a LeCodeDeUniOuiOuiOui data type which maps into a nvarchar.
But yes, these are the callouses I don't even recognize
 
@AaronBertrand Isn't it great! Who doesn't know what dt_wstr means? Also it rolls of the tongue so nicely.
 
@Zane Sounds like a curse.
 
@billinkc True that. However the names could be less stupid/confusing.
 
4:47 PM
@billinkc but presumably since you're running SSIS you're in a place where people are familiar with SQL Server, as you are usually using SSIS to get data into or out of SQL Server (and not necessarily involving any other platforms at all). I'd rather pick something analogous to the most likely platform in use than make some nonsense up.
YMMV.
 
Besides, the real CF with regard to ssis data types comes into play with execute sql tasks. Depending on your provider, OLE vs ADO, it might be AnsiString or might be Varchar which of course is all DT_STR with codepage 1252 for us murkins
 
I think they should support (or even force) Unicode compression in all editions and stop supporting non-Unicode strings at all.
Does C# even have a way to represent a non-Unicode string>
 
I get not using the SQL Server names but why not just Unicode since that translate pretty universally. DT_WSTR doesn't exactly tell you much.
 
Same with some of the options for BCP, BULK INSERT, etc. They all use names the developer came up with, probably while high.
 
@billinkc CF?
 
4:53 PM
Cluster F*ck, Charlie Foxtrot
Or Cold Fusion. Describes the awfulness just as well
 
I was in a traffic jam this morning, caused by a tow truck, parked, with its lights flashing, not doing anything. It was a total ColdFusion.
 
I hate Extended Events with a passion.
 
Or a total <CFQUERY>
@PaulWhite really? I think they are powerful, but not intuitive.
 
This is why being able to bike to work is the bee's knees.(why is that a saying)
 
@Zane would love to use a bike to take my daughter to day care. </sarcasm> :-)
 
4:58 PM
@AaronBertrand In Minneapolis people do that all the time. They are crazy about bicycles in this town.
 
@AaronBertrand I wasted an entire day trying to get syntax right, frigging about with XML splitting, trying to use the pathetic documentation ... insert rant here ... and it ended up not being suitable anyway because of seemingly random changes/omissions/CFs between 2008 R2, 2012, and 2014.
In summary: my time is extremely valuable to me, and XE just wasted heaps of it.
And I feel cross about it.
 
Scares the hell out of me when I see people towing their littles ones in one of those baskets behind them. Have you seen people drive?!
 
@PaulWhite "I fell cross about it"....does that mean like "mixed feelings"?
 
Actually I feel better now. Still want my 24 hours back though.
 
@PaulWhite send microsoft a bill
 
5:04 PM
@PaulWhite but, but....I still want to know what "I feel cross about it" means
 
@Lamak It simply means I am cross, and the crossness was caused by the events I described. No mixed feelings. Just cross.
 
> adjective: annoyed
 
@Lamak cross = angry
 
@Kermit They had a bill. Do they need a new one?
 
wasn't aware of that meaning
 
5:06 PM
@Lamak Yes.
 
@ypercube i see what you did there.. +¼
 
haven't seen that meaning before. I assumed wrong
 
JNK
@PaulWhite In this case, does the term CROSS APPLY?
9
 
Oh brilliant :)
 
@JNK I think you should stop commenting now, this is your peak ;-)
 
JNK
5:09 PM
@Lamak yeah I'm retiring
 
see?, you scared the rest of us
 
@ypercube yes they do, could you imagine this metro crap under Bill Gates?
 
6:17 PM
23 messages moved to Dual
 
@JackDouglas Access Denied
 
They could smell the SQL Server on you
 
@swasheck according to the logs you've now commented in there twice :)
 
@JackDouglas How did they choose than name (Dual)?
 
6:19 PM
i have to click a button, apparently
@ypercube the junk table for Oracle?
 
@swasheck It's not junk. It's a 1-row table.
 
@ypercube something about fairness because this room was originally called the Clustered Index
@ypercube it should be!
 
@ypercube didnt mean it to be pejorative ...
but i can see how it came across like that :)
 
@swasheck Sorry, I should have figured that.
 
@ypercube no worries. "junk" just meant "DUMMY record table"
 
6:26 PM
By the way, I haven't seen @Phil around the last days. What's he up to?
 
So adding a row into Dual is bad but I bet deleting the one row from there would probably cause even more havoc
 
And will we have another meeting? @Jack? @Concerned?
 
@ypercube read from here!
 
@JackDouglas That was a month ago!
 
@billinkc that is a evil thought :)
@ypercube true but I guess he is still sorting out his private life: he'll be back
 
6:29 PM
@JackDouglas oh wow. have you heard from him external to The Heap?
 
Indeed. I had not seen that. <3 out to Phil
3
 
@swasheck no, we chatted in here but not on Skype since
 
wow. hopefully he's recover(ed|ing) well
 
6:45 PM
@JackDouglas what is this?
 
can we just close this plz
I need something where Field2 values are grouped together. Then If all rows in field4 are 0 then dont bring back anything, but if some rows have a INT and some have 0 , bring back the entire row with 0.. Is that a little better. Sorry — Eddy 39 mins ago
 
3 bullets into it, do I hear 2 more?
 
@Lamak chat about moderating - I moved it to the mod room
just to be safe
 
oooh, ok then
 
@JackDouglas what chat
 
6:51 PM
@Kermit that's what I hoped you'd say :)
 
@billinkc you do realize this OP is ridiculous
> I am using SQL server 2013 express.
 
Well, they're connecting to the database from visual studio (probably express) ergo, mssql 2013 express
 
@billinkc stop being nice.. what's happening to you man?
 
It's the lack of sleep
 
it's annoying, fix it
 
6:55 PM
Not for a while unfortunately. Way behind on everything that isn't the 9-5 job
 
> put on hold as off-topic by Kermit, Nathan Hughes, billinkc, Lamak, swasheck just now
FLAWLESS. VICTORY.
 
SHORYUKEN
 
woot:
Photo: When a user asks for Microsoft certification braindumps on StackOverflow HT (@Justadayito) http://tmblr.co/Z14uHt1NMhYrP
 
@MikeFal 昇龍拳
 
Bah, someone flagged and removed my comments from that one
 
7:03 PM
@billinkc which one?
 
The one for the person begging for brain dumps
At least, I'm pretty certain I had comments on there
 
no deleted comments on that
 
Hmmm, guess it's time to head to the retirement home
 
@billinkc i would recommend one with a pool
 
It may be time to put old Bill Fellows down.
 
7:05 PM
For he's a jolly good Fellow...
 
@Zane Give me another day so I forget it's coming
 
@billinkc you were probably just thinking of mine
dumps like a truck, truck, truck. guys like what, what, what. — swasheck Jul 30 at 16:42
 
@billinkc Will do. Just add trip to the farm to your Outlook for tomorrow around noon.
 
Tell me about the rabbits
 
in the middle of my kid's baseball game on saturday, a corgi ran across the field with a rabbit's hindquarters in its mouth
 
7:08 PM
Nice!
 
it was pretty epic
parents were gasping. the boys were cracking up.
 
Last night while I was walking the dog, we came upon a little bunny just sitting there, maybe 8 feet from us. I braced myself for impact when it took off and my dog did nothing until it was across the alleyway
 
Then he realized, oh that was a tasty thing. I should chase it. On the way back, he was going ballistic at the bushes where the rabbit was but didn't see it sitting plain as day back on the other side of the alleyway. My story matters not because of the hypnotic picture from Kermit
 
@bluefeet are you from tuscon or phoenix?
 
7:10 PM
@Kermit Image not found.
 
Independence
 
misery
 
@Kermit She's from the East Coast.
 
Mizzurah you yankeeeeeee
 
this user has asked 17 questions ... i feel like he should be paying me
0
A: Vertica comparison operator with timestamp

KermitThe best practice is to explicitly define the date as part of your query: DELETE FROM [schema].table WHERE times_stamp <= '2014-05-06'; However, you can accomplish this dynamically using: DELETE FROM [schema].table WHERE DATEDIFF(day, times_stamp, SYSDATE()) >= 90; This will remove rows tha...

 
7:12 PM
@Kermit making money has turned you into quite the capitalist
 
@swasheck well, i either make money or i'm a communist
 
eh comrade
 
In Soviet Chicago, money makes YOU
 
it's #truth
 
*crickets*
nice
 
7:16 PM
@swasheck i miss that guy.. i no longer have bushisms to read every day
 
@JNK ... hey ... xml question. let me know when you have a few minutes
 
@swasheck AirCraft Carrier crew look light bright bulbs.
 
JNK
@swasheck shoot
 
@Kermit I'm from CT
 
7:18 PM
@JNK trying to parse an XE that has query plan embedded in it. this embedded xml has a namespace. i'm trying to figure out how to parse just that node with the namespace
(xml coming)
 
> Too many OB/GYNs aren't able to practice their love with women all across the country.
> Rarely is the question asked: Is our children learning?
> There's an old saying in Tennessee—I know it's in Texas, probably in Tennessee—that says, fool me once, shame on—shame on you. Fool me—you can't get fooled again."
 
<event name="query_post_execution_showplan" package="sqlserver" timestamp="2014-07-28T21:07:35.332Z">
  <data name="source_database_id">
    <value>1</value>
  </data>
  <data name="object_type">
    <value>20801</value>
    <text>ADHOC</text>
  </data>
  <data name="object_id">
    <value>388546253</value>
  </data>
  <data name="nest_level">
    <value>0</value>
  </data>
  <data name="cpu_time">
    <value>0</value>
  </data>
  <data name="duration">
    <value>0</value>
  </data>
  <data name="estimated_rows">
 
@bluefeet thanks, needed that for a security question
 
JNK
@swasheck so what do you want to get out?
 
@JNK i'd like to be able to pull data from the "estimated_rows" node as well as to be able to shred the "showplan_xml" ... but my namespacing feels off
with xmlnamespaces (default 'http://schemas.microsoft.com/sqlserver/2004/07/showplan')
wont pull <data name="estimated_rows">
i just get a blank stare
select
	q.p.value('.','nvarchar(255)') estimated_rows
	,xe.event_data
	from (
		select top 10 file_name, event_data
		from event_files
	) xe
	cross apply xe.event_data.nodes('//event/data[@name="estimated_rows"]/value') q(p)
gets me the row estimates
with xmlnamespaces (default 'http://schemas.microsoft.com/sqlserver/2004/07/showplan')
select
	q.p.value('.','nvarchar(255)') estimated_rows
	,xe.event_data
	from (
		select top 10 file_name, event_data
		from event_files
	) xe
	cross apply xe.event_data.nodes('//event/data[@name="estimated_rows"]/value') q(p)
is an empty set
also - i can't even pull the query plan xml
 
JNK
7:26 PM
one sec
 
with xmlnamespaces (default 'http://schemas.microsoft.com/sqlserver/2004/07/showplan')
select
	--q.p.value('.','nvarchar(255)') estimated_rows,
	xe.event_data.query('/event/data[@name="showplan_xml"]/value/ShowPlanXML') qp_xml
	--,xe.event_data
	from (
		select top 10 file_name, event_data
		from event_files
	) xe
 
JNK
do you don't want it to be default
 
this just gives me
 
JNK
you want to NAME it
 
JNK
7:26 PM
;with xmlnamespaces ('http://schemas.microsoft.com/sqlserver/2004/07/showplan' AS SP)
Then use that for only the showplan element
SP:ShowPlanXML
when you set it do default it expects all elements to be in that namespace
so you get nothing
 
hm. ok.
 
JNK
and you don't even need it
I put what you gave me in a var called @x
this works:
;with xmlnamespaces ('http://schemas.microsoft.com/sqlserver/2004/07/showplan' AS SP)
select
	q.p.value('.','nvarchar(255)') estimated_rows
	,s.pl.query('*')
	--,xe.event_data
	--from (
	--	select top 10 file_name, event_data
	--	from event_files
	--) xe
	--cross apply
FROM @x.nodes('//event/data[@name="estimated_rows"]/value') q(p)
CROSS APPLY @x.nodes('//event/data[@name="showplan_xml"]/value') s(pl)
the .query() method returns the xml
just pull from the value node, not the ShowplanXML node
 
i must've screwed up the path somewhere in there.
thanks, @JNK
 
JNK
NP
 
two upvotes
 
JNK
7:34 PM
if you DO want the showplan portion of the xml you can use .query but you need to do the SP: prefix for the namespace
 
@JNK i'm searching. what would that look like?
 
JNK
CROSS APPLY @x.nodes('//event/data[@name="showplan_xml"]/value/SP:ShowPlanXML') s(pl)
 
ah
cool
 
JNK
using the namespaces in my query above
 
thanks
 
JNK
7:35 PM
no problem
I like XML puzzles
 
That's just weird.
 
@PaulWhite agreed. but it's useful
 
JNK probably does his own dentistry too.
 
easier than XML
 
JNK
@PaulWhite there's a certain satisfaction in working on things most people don't enjoy
 
7:37 PM
@PaulWhite with the least intuitive tools he can find.
 
@bluefeet i'm originally from my mom
 
@JNK That's what my dentist says :)
Summary of the transcript so far: JNK is special
 
Speaking of self-dentistry, I'm always reminded of this horrific article from a soviet era citizen
 
JNK
lol
 
JNK
7:39 PM
I'm a short poppy
 
thank you google radio. Cult of Personality
 
JNK
PS @PaulWhite I finished watching that and it was great, hope you got to see it
 
@billinkc KC bear
 
No, KFC
 
7:54 PM
&()#(&$#*()#(&*@^E*(#^&*(#&*(_&)#(@*)(#UI@_&)($&)*@#(R*(#)@&*(@*&$)(@#_&%&@*()‌​&*(
 
04:00 - 20:0020:00 - 23:00

« first day (1308 days earlier)      last day (3568 days later) »