« first day (1386 days earlier)      last day (3485 days later) » 

8:42 AM
There is no OptionB, only A. Storing data as comma delimited values in databases is ground for immediate termination. — Remus Rusanu 2 hours ago
 
 
2 hours later…
10:50 AM
It's contagious.
 
 
1 hour later…
JNK
12:12 PM
morning all
 
morning @JNK
 
12:36 PM
morning
 
JNK
Yesterday I learned that the columns in a VALUES clause for an INSERT statement must be of the same type for all rows
We were trying to insert a bunch of test data into a table with a SQL_VARIANT and it bombed
 
Isn't it enough that they are compatible types?
 
JNK
yes compatible sorry
but we were inserting ints and varchars
 
Ah, right
 
JNK
and the ints were listed first in the VALUES
 
12:43 PM
The destination column was of type sql_variant?
 
JNK
yes
 
Were you converting the first row of the VALUES list explicitly to sql_variant?
 
JNK
no
Should we have?
they were cast as their type explicitly
 
SQL Server plays fast and loose with types. I try to be explicit wherever possible and it often pays dividends.
 
JNK
I assumed with a variant we would want to use the type we wanted stored
so the ints we cast as int and the varchars we cast as varchars with a defined length
 
12:45 PM
No.
 
JNK
you can't cast as a variant explicitly it looks like
let me research
 
@JNK Then (I guess) SQL-Server attmepted to convert the varchars first to int?
 
JNK
@ypercube yeah
I presumed it was because the VALUES was really being treated as a table expression
took me a little to figure it out because it was ALSO inside a tSQLT unit test and we thought it might be an issue with that
 
DECLARE @T AS table (c1 sql_variant NULL);

INSERT @T
	(c1)
VALUES
	(CONVERT(sql_variant, 1)),
	(CONVERT(sql_variant, 'banana')),
	(CONVERT(sql_variant, $50));

SELECT * FROM @T;
 
JNK
ah ok
 
If you wanted a particular base type inside the variant, as it were, you could nest another CONVERT.
@AndriyM Yeah. The second one is a little 'sloppy' because it relies of type precedence and an implicit conversion.
 
JNK
I was trying to use CAST
 
@PaulWhite I see, explicit conversion at all times is best, thanks.
 
@JNK Well CAST would work too.
 
JNK
I must have had another issue, I was getting a weird syntax error
for an INSERT it looks like it only cares about the first row being cast as a sql_variant
 
12:52 PM
boom
0
A: Export vertica query result to csv file

KermitYou're using a syntax that's not valid for Vertica. Please read the documentation. Vertica only supports exports locally. The client your using needs to have support for a file export. For example, in Excel, you could set up the ODBC connection and import the data.

 
JNK
DECLARE @T AS table (c1 sql_variant NULL);

INSERT @T
(c1)
VALUES
(CONVERT(sql_variant, 1)),
('banana'),
($50),
(1),
('foobarbaz');

SELECT * FROM @T;
 
@JNK Yes but multi-row VALUES is just a UNION ALL of expressions, so type is determined initially by the first row. It's more typing to be explicit, but IMO it is better.
 
JNK
oh I'm fine with it
I'm just trying to find the point at which it breaks
 
@Kermit -1 BOOM
:)
 
So basically the rule is the VALUES should work without the INSERT, for instance in SELECT * FROM (VALUES ...)
I guess
 
12:59 PM
Struggling with SQLFiddle today. Anyway: sqlfiddle.com/#!6/a2178/2
 
@bluefeet you're funny
 
Yo.
 
1:23 PM
@Kermit I try but mostly I fail
 
1:43 PM
Does UNION ALL guarantee the order of results? I mean, if we take a simple statement of SELECT * FROM a UNION ALL SELECT * FROM b, will rows from a always precede rows from b in SQL Server? This is not about whether rows from a or rows from b will always be sorted the same, it's just about the order of the groups of rows.
 
I don't know that I would trust that it's all of the time.
 
I asked someone recently about this, because they said in their answer that the order would be the same. They replied it's in the standard but admitted it was only their observation with regard to SQL Server specifically (as well as the many other database systems they worked with).
 
@AndriyM Why wonder? Add a column to the result set that shows which result set the row comes from, then order by that. Voila.
 
@AndriyM I don't think it's in the standard.
 
@MaxVernon Yes, that's what I would go with. I'm asking because I was questioning someone's claim that the order would be preserved and was told it's in the standard.
but possibly not in the SQL Server manual.
 
1:49 PM
@AndriyM I'm guessing here but trying to force a parallel plan might get the rows in mixed order.
 
I'd go with the fallback answer of "it may appear that way but it's subject to the whims of the database internals and can change at any time unless there's an explicit order by"
 
Same as a single SELECT without an ORDER BY then, basically. That was always my guess too. I also found this:
11
Q: Does UNION ALL guarantee the order of the result set

whytheqCan I be sure that the result set of the following script will always be sorted like this O-R-D-E-R ? SELECT 'O' UNION ALL SELECT 'R' UNION ALL SELECT 'D' UNION ALL SELECT 'E' UNION ALL SELECT 'R' Can it be proved to sometimes be in a different order?

 
2:08 PM
Useless tag, if you asked me.
 
@AndriyM The standard has:
> If a <query expression> does not simply contain an <order by clause>, then the ordering of rows in the table specified by that that <query expression> is implementation-dependent.
 
@ypercube and <query expression> covers UNION ALL queries too?
 
yes
 
thanks
 
    <query expression> ::=
      [ <with clause> ] <query expression body>
        [ <order by clause> ] [ <result offset clause> ] [ <fetch first clause> ]

<query expression body> ::=
  <query term>
  | <query expression body> UNION [ ALL | DISTINCT ]
    [ <corresponding spec> ] <query term>
  | <query expression body> EXCEPT [ ALL | DISTINCT ]
    [ <corresponding spec> ] <query term>
@AndriyM In the -02- file in this zip: sql20nn.zip
 
2:30 PM
@ypercube Thanks! That's a draft, isn't it?
 
0
Q: Wondering what the process for reopening a closed question here is?

noonandVersion lie shim for SQL Server 2014 The above question was closed (for incorrect reasons IMHO). I've answered the charges and the question hasn't been revisited. Is there no process whereby those who close questions periodically review those questions when they're edited to clarify any reasons ...

 
I vaguely remember hearing somewhere that final documents aren't easily accessible
 
And a blog post by Conor Cunningham. Not specific about UNION ALL but plays with growing the table until it hits a parallel plan: No Seatbelt - Expecting Order without ORDER BY
@AndriyM Yes. because you have to pay ANSI / ISO to get the actual documents.
I think the 89 or 86 version is free, somewhere on the net as a text file.
 
You can also check with libraries as they'll have already paid for them.
VtC shopping list
1
Q: ERP sample data sets download

Sandeep PulikondaI am looking to download sample ERP data sets to play with in sql server. Can anyone give me suggestions where can i get the sample data for banking domain , finance domain, insurance domain or health domain

 
What does he mean by ERP?
 
2:40 PM
@billinkc voted
 
enterprise resource planning is my usual definition for erp
 
@Zane enterprise resource planning
 
Hmm. I'll have to add that to my brains list of initialisms.
 
We produce N widgets daily, they require these raw materials. Takes N lead time to get those materials in. Sales cycle is X, accounting (AR/AP/GL) does y, etc. Big, ugly, interconnected mess
My first post college job was working on one that used a "c like" language for interacting with the data
They used a database, Ingres, that was targeted for unix but we were one of two companies that insisted running it on NT. Anyways, all the processing was procedural but I learned some SQL on it
And by learning, I wrote what was probably a cartesian product and crashed the database server
 
JNK
@billinkc those are the fun lessons
I broke an 800m row dataset with a busted archiving process
I joined a header to a detail record to make sure I archived only stuff where all the detail records were outside the date range
when I did my delete I deleted on the wrong ID so I basically deleted 100m random records
 
2:45 PM
It was my first interaction with a DBAhole and that set a bad precedent for future DBAs
 
JNK
like 80 people on a $100m line of business had to stop work
 
@JNK Ewwwww
 
JNK
@billinkc ugh that's not good
I had to fix it during an epic snowstorm from home too
 
Yeah, if this ERP system went down, they knew exactly how much per minute they were losing when the presses were idle
 
JNK
@billinkc uggghhh
 
2:47 PM
I'd get the bigwigs from the shop storming over to our building and you could hear their teeth grinding as they stood over your shoulder waiting for you to perform miracles
 
JNK
@billinkc yeah people always work faster with executives standing over them
 
That, despite the sound, was actually beneficial as it developed a callous so early I can easily not give a sh*t about anything
 
Yeah. Finally got my work dress3er.
 
3:03 PM
Surprised this hasn't been posted here yet: ozar.me/2014/10/guess-bug-source-microsoft-sql-server-mongodb
 
@mmarie I have some major bar hopping planned for after SQL Saturday. It's all on the way to the official after party too.
 
@billinkc that's your job every day?
 
Something happened to Connect? I can no longer have my tea while it's opening.
 
3:19 PM
@billinkc Quite a useful life skill for one working in I.T.
 
Is anyone having any issues loading SO today? Slowness?
 
not really
 
3:45 PM
@AndriyM That happens now and again just to tease us. It'll be glacial again in an hour or two.
 
It's quite a spiteful website.
 
4:00 PM
what?
-5
Q: SQL server 2008 Urgent

black warSQL server 2008 problem When I wrote the request does not underline errors +No completes writing the names of the tables and .. when typing the first letters of which Knowing that if the demand is true, then the result shows true Thank you

 
@Lamak Piped through Google Translate, it seems
 
> Knowing that if the demand is true, then the result shows true
 
So... when you go to the emergency room with a broken arm, do you just say "Urgent, nailpolish is wrong color" and then get mad when the doctor tells you they're not cosmeticians? — Marc B 7 mins ago
 
@Lamak Yeah I haven't the foggiest clue on that one.
 
an intellisense issue, but, c'mon
 
4:15 PM
I didn't even get that far. My brain couldn't compile that at all.
 
JNK
5:03 PM
@billinkc you around? I have an SSIS question/issue
 
sure thing
@JNK ping
 
JNK
@billinkc yay
So, we have an SSIS job that uses a WMI reader to get data from a web server's event log
Last week we stopped using the old web server and started using a new one
I just needed to repoint the WMI connection to the new web server
EASY PEASY right?
But it's giving me some crap about not being able to read the Password XML node in the package which is an encrypted node
I'm not sure why it needs a password for the WMI connection tho since it's using windows auth and there's no username specified
 
How are you passing that connection?
 
JNK
It's a connection object in the package
WMI connection with connectionstring to the server etc etc
UseWindowsAuth=True
 
Did you change the connection string in the package then? You aren't passing it through a config file or anything like that?
 
JNK
5:17 PM
nope no config file
this is a pretty simple package
 
I suspect your package has the package protection level set to EncryptSensitiveWithUserKey. It's a lazy implementation and it will encrypt any connection string data, even if it's using windows auth
 
JNK
it polls the events and dumps em into a table
it does
so what should I set it to
im not worried about this being visible
 
Unless you use a password in an SSIS package, I never have my protection level set to anything but DontSaveSensitive
 
JNK
it's on a server that nobody has rights to that doesn't know this pw anyways
 
Is there a password somewhere in the package though? Perhaps talking to the webserver?
 
5:27 PM
Oh at Wand the account didn't have enough access to the the folder the drive was on.
 
JNK
don't think so
only PW I see is on the WMI conection
 
Ok, saw web service figured there could be on there
 
JNK
ill know in a sec
failed again ERRRGGGG
 
should have used vertica
 
JNK
ok looks like a rights issue
THAT I can deal with
 
5:36 PM
It only has booms
 
6:01 PM
@ypercube ...
@ypercube sure it does. It just doesn't let the user select the actual month they want. What OP needs is a clear stored procedure that does basic TSQL (which means this is an SO Q) but what this answer offers is a RAD approach designed to indicate quickly in a demo how the product should work and as such I consider the informality of this post quite the avant garde expression for how little effort would go into such a query. I can definitely understand the delicate cycle of decision that led to this new poster on our site sharing such a simple selection, and allowing us to infer the obvious — jcolebrand ♦ 44 secs ago
too much?
That may have been a little too much ...
@neilmcguigan got a second?
@Neil Feel free to take your time when crafting your post. You don't often need to edit 20 times in posting. ;-)
 
I'm really tempted to gin up an answer that changes the system date to whatever month is selected and then Serg's answer would be correct. Problem is, that'd require me reading php manuals
 
@billinkc the issue is ... how do you select a previous month?
 
Change the system date to one month less and then get current, duh
 
I like the zen nature you've got going on here
I'mma guess you're a fan of mind reading PHP and mind reading reading SQL?
 
6:16 PM
Is there any other way/
There is only zuul
 
resolution
Just because my language is not English , I dabble SQL server 2008 , It is no longer shows me the errors — black war 2 hours ago
 
6:34 PM
@jcolebrand Ya, sorry about that one. I'll cut down on my over-zealous edits...
 
haha, no worries mate
It flags us after about ten or so
sometimes people get into edit wars, sometimes they're trying to be malicious
yer fine
 
7:01 PM
#DumbQuestions
...
how do I use 2014 to backup to something 2012 can restore from? #MSSQL
 
I bet inspirer systems has a product for this
 
@billinkc boom have a star for that
are you referring to this?
-145
A: Info: Contacted by a spammers (Ispirer Systems) referencing Stack Overflow

Ispirer SQLWaysWe would like to comment on behalf of the company. There are several questions on this website, the possible solution to which can be the use of our tool. Our answers were always deleted by the site administration, despite of the fact that they contained useful information for the SO users. Th...

 
:D
94
Q: Info: Contacted by a spammers (Ispirer Systems) referencing Stack Overflow

SchmitzITNot sure if anyone else got this, but I found the following in my mailbox: Hi, Peter! My name is [removed], and I’m Sales & Marketing Manager in Ispirer Systems. I found your contacts on stackoverflow.com. We are impressed with your activity on this website. Our company would appre...

High five!
 
And now we're completely derailed ...
 
7:04 PM
I love the fact that the answer has 2 upvotes
I'm just gonna keep a browser window open to this answer the rest of the day. It's like watching the National Debt Clock tick! — Ogre Psalm33 18 mins ago
 
So not to complain or anything but out of all of the submissions put in for SQL Sat MSP I've found some of the suggestions to be a little disappointing. It's like they had to get all the hits in or something. A good portion of these have been done many times at user groups/last years SQL sat MSP/most of the other SQLSaturdays in the Midwest.
 
@Zane you're just too fancy going to all those other events
 
I know most people don't go to every Midwest SQL Saturday but it still seems a bit odd.
 
I will simply state that were I in charge of MSP, I would have chosen differently
 
Like I said this may just because I'm Very active and therefore have seen many of thse
 
7:12 PM
anyone going to buy sqlserver.help ?
 
sabermetric sql?
0
Q: Nested Sabermetric SQL - Average Plate appearances and Games

user1093111I am trying to find the average games and average plat appearances for the MLB over the 2012 season for outfielders ORDERED BY their birthYear. Currently, this SQL shows entries for each player. The database is the lahman database http://seanlahman.com/files/database/readme2012.txt I get the ...

 
It might be that they wanted to go with known quantities versus risking an unknown entities. To me, that's the beauty of these events. It might be great, might be crap
Part of the purpose of these, as I see it, is to grow your local speaker base but if you don't pick locals, you can't grow them. Crazy
 
7:41 PM
I was having troubles figuring which presentations I was going to go to.
There are 3 sessions that I really am interested in.
And 2 are SSIS and I want to see how a few do things differently.
Anyway. I guess I shouldn't gripe.
 
8:02 PM
@jcolebrand if the database exists on 2014 already, no, you can't. Create an empty database on 2012, then run a compare or use import/export.
 
8:51 PM
I really have when people just make assumptions while troubleshooting.
 
One more VtC
0
Q: SQL Insert Statement Persists Two Records When I Need Just One

Angelic1AngI have altered it to include hardcoded variables when I pulled this chunk of code from the stored procedure. I ran it independent of the application with the same result. I need one insert statement and one update statement to execute if the required conditions are met per record share processed....

 
Between strikes again!
Time to pass the ole what do between and the devil have in common around the office again.
 
9:37 PM
Spam. Same wording as the previously deleted answer (by different user): dba.stackexchange.com/questions/78370/…
 

« first day (1386 days earlier)      last day (3485 days later) »