« first day (2255 days earlier)      last day (2607 days later) » 

4:06 AM
0
Q: Creating an array or list or collection of children of an abstract base class

Evan CarrollTrying to help a friend out here. I'm not a Microsoft programmer. public abstract class Foo {} public class Bar : Foo {} public class Baz : Foo {} This seems to work pretty well then in another class he can instantiate arrays of Bar, and Baz like this public class MyClass { Bar[] Bars = new...

 
 
4 hours later…
8:09 AM
Mornin'
Scrolls up. Too much bold text
 
8:22 AM
Text boldly going where no text has gone before.
 
Heap Trek ?
 
morning
 
8:54 AM
morning
 
morning
@Philᵀᴹ it's only mildly amusing, as I don't see half of the conversation :)
 
Heh
 
10:06 AM
@Dobob everything can be normalized :) If it's not very secret, what sort of data it is? (Asking as a geneticist-turned-DBA.) — dezso 24 secs ago
 
@dezso He works for Jurassic Park. It's Dino DNA!
 
10:30 AM
StackExchange really does know everything ux.stackexchange.com/questions/18238/…
 
16k columns T_T
they should hang the dba for allowing such a mess
   |/|
   | |
   |/|
   | |
   |/|
  (___)
  (___)
  (___)
  (___)
  (___)
  // \\
 //   \\
||     ||
||     ||
||     ||
 \\___//
  -----
 
11:50 AM
@AndyK there is no table yet, it's a flat file
 
 
1 hour later…
1:01 PM
I don't really get what this guy wants
0
Q: SQL concatenate VARCHAR + VARBINARY keeping VARBINARY value in string

daveyAs the title suggests, is possible to concatenate the 2 without converting the the data types... DECLARE @test VARCHAR(50) = 'Hello World!' DECLARE @testvb VARBINARY(256) SET @testvb = CAST(@test AS VARBINARY(256)); SELECT @test + @testvb --dont want to cast this back to var char

 
Me neither
 
@Philᵀᴹ so weird
 
@Lamak Glad I could help...
 
I'm glad too
 
Clickety
 
1:25 PM
the noose should be for the one who created that file @dezso. ;))
 
1:44 PM
SQL Server instances on dbfiddle create a new database for every execution, could they just use tempdb instead? I mean is there anything (useful) you can't do in tempdb that you can do in a dedicated database?
 
2:26 PM
@JackDouglas My first thought is that it would be possible to interfere with other people's tests
or to have name collisions
I don't know how likely that is
it is possible to create objects that stick around in tempdb until the server restarts
 
2:37 PM
@JackDouglas maybe the database could be created once at the beginning of a user session, then dropped after some timeout? That would decrease the I/O requirement, and speed up each execution. Just a thought.
 
It says here: "Any user can create temporary objects in tempdb. Users can only access their own objects, unless they receive additional permissions." — I assumed that meant each session effectively gets it's own tempdb namespace
@MaxVernon the CREATE and DROP are quite quick
 
@JackDouglas sort of. You can create a #temp table with a user-specified constraint name; that name must be unique across all sessions.
 
ah
so that is a "global temporary table"?
 
correct. the name of the #temp table is scoped to your session, whereas the name of any constraints where you define the name of the constraint must be unique across all sessions.
 
@JackDouglas you are way too young to be worrying about this though
 
2:39 PM
@JackDouglas no, global temporary tables need to be uniquely named across all sessions.
 
@Lamak I'll be 13 on Friday :p
 
congrats!
 
so we can both do create table #t (id int), but only one of us can do create table #t (id int constraint t_id primary key clustered)
 
@MaxVernon I guess that is a problem anyway, right now — are #temp tables created in tempdb by default?
 
@JackDouglas yes, they always exist in tempdb
 
2:41 PM
ok so this is a separate issue
 
and correct, it is a separate problem.
@JackDouglas I must say, I've not been annoyed by the execution time.
it seems quite quick to me
 
yes, it isn't too bad is it
 
no, it's very good.
 
however using tempdb would be simpler code
 
right.
do you intend to open-source the code?
 
2:43 PM
is there any way round the constraint name collision issue that you know of?
 
you'd have to uniquify them manually; which would be a nightmare.
the standard way around that is to not explicitly name constraints for objects in tempdb. If you don't specify a constraint name, SQL Server generates one automatically, and it's unique.
 
I think the problem is if the table name does not start with #
 
11
A: Create PK for #temp table failed when the script is run in parallel

gbnThis can only happen if the same client connection instantiation (which equals one SPID or connection in SQL Server) is being re-used for 2 different calls. Two parallel calls should have different connection instantiations and separate SPIDs SPIDs are completely isolated from each other with lo...

 
the problem with that is copy-pasting code to test it would mean you'd need to remove any explicitly named constraints.
 
no, I understand that there's an issue with constraints
I meant that what I was trying to get at before was if people created temp tables that don't start with #
I'm pretty sure the data just stays there
 
2:46 PM
@JoeObbish yes, it does. until drop table xxx is issued, or the server restarts
 
or the transaction that created the table rolls back
 
they don't disappear magically when the session ends?
 
ones that start with # or ## do
 
no, only #temp tables disappear at the end of a session
what Joe said
 
2:47 PM
ok, using tempdb isn't easier for me then I'll stick with dedicated databases
I'll eventually find out what is causing the 3s delay when connecting for the first time with the new login — but that's not high priority
 
@JackDouglas meh, it works great as it is. Maybe a nintendo switch as a token of appreciation on friday would be nice ;)
 
I could add a timeout, but some fiddles legitimately take a while to execute. Not sure which is best — Jack Douglas ♦ 18 secs ago
 
@JackDouglas I'd be tempted to register rdbms.me or something similar to point to your fiddler
 
@Philᵀᴹ if I do that I have to make sure it works forever or links will break.
 
sql.cloud maybe? It's only €52k :)
 
2:54 PM
.uk links are easy for me because we are a Nominet member
 
@JackDouglas Isn't there already a timeout?
"Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding."
 
@JackDouglas Ah, cool :)
 
@JoeObbish not one I've added — maybe the driver times out on some operations but not on the overall execution of a batch?
 
I love answers with:

Edit:

Ignore above
 
@JackDouglas I see. I think it's ok as is. At least I can't easily break it anymore. Thanks for the fixes!
 
2:58 PM
You are welcome thanks for the testing!
does USE MASTER really just affect the default namespace for unqualified names, or do I need to revoke the ability to do it?
 
don't let people do "USE MASTER"
 
nothing compares to spoonfeeding devs while trying to prepare an inter-DC failover in another thread
 
@JoeObbish how do I prevent that?
 
@JackDouglas oh, before it didn't work
oh, sorry
I was unclear
when I complained about use master throwing the weird error message
I wanted a proper error message
not for it to work
Msg 916 Level 14 State 1 Line 1
The server principal "fiddle_401cd1359db24148a13fbfecaab29641" is not able to access the database "model" under the current security context.
imo that is what should happen with the other three
I didn't answer your question because I'm pretty unknowledgeable when it comes to security
 
OK, thanks I will Google ;)
hmm "The guest user can not be disabled in master or tempdb"
you already can't do stuff in master: dbfiddle.uk/…
maybe that's enough
 
3:11 PM
yeah I just checked that
not being able to do anything should be enough afaik
 
The EXECUTE permission was denied on the object 'sp_OACreate', database 'mssqlsystemresource', schema 'sys'. Hehe
 
I'm not sure if this is a known issue: dbfiddle.uk/… returns "22P02ERROR: invalid input syntax for type json DETAIL: The input string ended unexpectedly. CONTEXT: JSON data, line 1: "
 
3:41 PM
@MaxVernon it's falling over on certain column(s), I haven't worked out which yet, but this works: dbfiddle.uk/…
 
@JackDouglas What's the query that fails?
 
@JoeObbish select * from sys.databases;
 
huh, that worked an hour ago for me
I see
works on 2016, but not vNext
so probably a new column
@JackDouglas service_broker_guid
 
4:34 PM
bye folks
 
@AndyK tschüß
 
 
2 hours later…
6:45 PM
hi folks
 
6:58 PM
@JoeObbish thanks, 'fixed' in that I'm now returning something rather than crashing. If the driver thinks the return type is 'unknown' I return it as hex now. I think the Windows SQL Server instances are going to work better than the Linux version simply because the drivers are better — I might add a vNext Windows variant at some point.
 
7:18 PM
@JackDouglas Do you plan to add other dbms?
 
are you referring to MySQL by any chance?
 
NoMySQL.
(not only to MySQL ;)
 
SQLite and DB2 are on my TODO list
along with MySQL, MariaDB
not sure what else there is?
 
teradata!
 
Of those, MySQL is probably easiest from me to implement — the others I'll have to learn as I go along
@JoeObbish is there a free version?
with a suitable license
 
7:23 PM
@JackDouglas not sure. was supposed to be a joke. only 41 questions tagged with it
 
@JackDouglas It would be nice to have Maria 10.2 that has window functions, even if it's still RC.
 
7:44 PM
@JackDouglas it's securing them that's the biggest task
 
@JoeObbish Teradata and Vertica (boom)
 
/me pours out a fourty for Kermit
 
@JackDouglas Firebird? And Access, Sybase (but probably no free versions)
 
@billinkc as if you needed an excuse
 
@Lamak Sometimes I don't knock everything over
 
7:53 PM
yeah....sometimes
 
@ypercubeᵀᴹ @jack SAP ASE Express is available for free - sap.com/cmp/syb/crm-xu15-int-asexprdm/index.html?kNtBzmUK9zU
SAP owns it now since they bought it from Sybase a while back.
 
@MaxVernon interesting. Do you have a link with the restrictions (cpu, ram, size) compared to paid versions?
 
not handy. The Express edition allows 50GB and up to 4 "engines".
engines are separately configurable execution units or something
 
@ypercubeᵀᴹ wow, so practically unlimited then.
50GB is a pretty decent max size database for most uses.
 
Yes, no limitation on CPUs, cores or memory.
A lot on features (compression, encryption, availability, partitioning, in memory, etc)
 
8:30 PM
Nothing Microsoft do surprises me any more
 
I'm going to have to fire up a Linux VM and install SAP ASE Express I think.
@JackDouglas that's super cooool.
I'm gonna run Windows Server on my phone one of these days. lol.
yah, the GUI-less version, too.
 
@MaxVernon let me know how easy it is
 
will do
 
Can add HANA too ..
 
interesting, its packaged as a .tgz - will be interesting to see whats in that tarball.
 
8:45 PM
in Discussion between ypercubeᵀᴹ and Marcus Junius Brutus, 1 min ago, by ypercubeᵀᴹ
@Marcus nice analysis. I've edited the answer - just a bit - and reverted my vote ;)
To @mods. Can I delete my comments from the question now - that they are in the chat room? I'm always hesitant, fearing they might be deleted from the chat, too.
 
9:02 PM
@JackDouglas this is great: "Words that ought to freak out Intel more than just a little bit."
 
@ypercubeᵀᴹ I don't believe there's any link between comments and their chat room copies like that. Mods often move long discussions to chat by creating a chat room containing all the comments and removing the (original) comments.
 
@Philᵀᴹ Greenplum
 
9:17 PM
@wBob DBase IV
can you even run that anymore? lol
 
@ypercubeᵀᴹ Yep safe to delete. It's a copy not a link.
 
9:38 PM
@Philᵀᴹ I don't think it's possible — all I can do is secure the central VM, not the DB backends. Oracle XE gets no patches at all as you no doubt know.
 
10:05 PM
0
Q: How are queries optimized through the use of Relational Algebra and/or Relational Calculus?

HeadsR'UsSo basically I was wondering how are queries optimized through the use of Relational Algebra and/or Relational Calculus. Please be clear :)

^^^ please be clear...
lol
 
huh
I was going to skip that one but he said "please"
 
one gets the feeling one could write a book about that particular subject, if one was really trying to be clear.
 
Maybe he just wants us to explain at great length.
2
 
@Forrest that we can do.
not that I will...
 
I thought that "your question needs an entire book to answer" was an example of when to close?
2
 
10:18 PM
@JoeObbish yes, I believe it is.
gonna be a bit chilly tonight: weather.gc.ca/city/pages/mb-38_metric_e.html
 
11:25 PM
If you have a table with a composite key, where one column is a Type to ensure that only entities of the right type are in the table, do you just put the FK relationship with the composite key, or do you also do an FK for the Type to the Type table? For example...
I guess I should ask the question, but it's kind of subjective perhaps
CREATE TABLE WidgetType(WidgetTypeId int identity(1,1) NOT NULL PK, WidgetType varchar(100));
CREATE TABLE Widget(
   WidgetId int identity(1,1) NOT NULL PK,
   WidgetTypeId int NOT NULL CONSTRAINT FK_Widget_WidgetType FOREIGN KEY REFERENCES WidgetType(WidgetTypeId),
   WidgetName varchar(100)
)
CREATE TABLE WidgetRel(
   ParentWidgetTypeId int NOT NULL,
   ParentWidgetId int NOT NULL,
   ChildWidgetTypeId int NOT NULL,
   ChildWidgetId int NOT NULL,
   CONSTRAINT FK_Widget_Parent FOREIGN KEY (ParentWidgetTypeId, ParentWidgetId) REFERENCES Widget (WidgetTypeId, WidgetId),
   CONSTRAINT FK_Widget_Child FOREIGN KEY (ChildWidgetTypeId, ChildWidgetId) REFERENCES Widget (WidgetTypeId, WidgetId),
   CONSTRAINT CK_ParentWidgetTypeIsFrob CHECK (ParentWidgetTypeId = 1),
   CONSTRAINT CK_ChildWidgetTypeIsGlob CHECK (ChildWidgetTypeId = 2)
In table WidgetRel, would you also make an FK from ParentWidgetTypeId to WidgetType (and for Child as well) or simply trust that because of the chained FK relationship there is no need?
For completeness:
SET IDENTITY_INSERT WidgetType ON;
INSERT WidgetType(WidgetTypeId, WidgetType) VALUES (1, 'Frob'), (2, 'Glob');
SET IDENTITY_INSERT WidgetType OFF;
Feel free to recommend I ask the question as a real question
 
@ErikE I would trust there is no need.
Also, in case one wants to define ON UPDATE CASCADE actions, SQL Server wouldn't allow them, due to the multiple path
 
11:42 PM
@ypercubeᵀᴹ Oh that's something I didn't consider.
 
I would be rare to need updates on the identity columns so probably CASCADE action would not be of much use there anyway.
 
@ypercubeᵀᴹ Does postgre 8.4 have DENSE_RANK() ?
 
Not sure but I can check
 
You can solve dba.stackexchange.com/questions/166374/grouping-or-window as the difference between 2 DENSE_RANK() operations
 
Yes, it has.
@ErikE You can add an answer!
 
11:49 PM
@ypercubeᵀᴹ But I don't know postgres syntax
CTEs?
 
@ErikE CTEs work fine.
Juts avoid SQL Server specific syntax like SELECT alias = expression .. and you are fine.
You can take AndriyM's dbfiddle and test: dbfiddle.uk/…
 
@ypercubeᵀᴹ I'm already doing that!
 

« first day (2255 days earlier)      last day (2607 days later) »