I have the following SQL query output    I would like to have the output in the following format  +--+------+ |ID|RoleID| +--+------+ |1 |1, 4  | +--+------+ |3 |1     | +--+------+ |5 |1     | +--+------+ |6 |6     | +--+------+   So on.  How to I achieve this?
I'm trying to migrate a MySQL-based app over to Microsoft SQL Server 2005 (not by choice, but that's life).  In the original app, we used almost entirely ANSI-SQL compliant statements, with one significant exception -- we used MySQL's group_concat function fairly frequently.  group_concat, by the way, does this: given a table of, say, employee names and projects...  SELECT empName, projID FROM project_members;   returns:  ANDY   |  A100 ANDY   |  B391 ANDY   |  X010 TOM    |  A100 TOM    |  A510   ... and here's what you get with group_concat:  SELECT      empName, group_concat(projID SEPARATOR ' / ')  FROM      project_members  GROUP BY      empName;   returns:  ANDY   |  A100 / B391 / X010 TOM    |  A100 / A510   So what I'd like to know is: Is it possible to write, say, a user-defined function in SQL Server which emulates the functionality of group_concat?   I have almost no experience using UDFs, stored procedures, or anything like that, just straight-up SQL, so please err on the side of too much explanation :)
Roast duck vs. roasted duck I am looking at some code and it has this statement:    ~ConnectionManager() {     Dispose(false); }   The class implements the IDisposable interface, but I do not know if that is part of that the tilde(~) is used for. When using sudo powers and calling gedit the top level menu with File Edit View Search Tools Documents Help is missing.  If I create user ID root and sign in once and call gedit will it create the necessary user configuration files that might fix this?  Will this also make the annoying error messages go away whenever I use sudo, gksu or pkexec as a regular user with elevated privileges togedit ?  Will there be other benefits with Nautilus and other Gnome derivative Ubuntu applications?  NOTE: by sudo powers you can google pkexec gedit 3.5k hits, gksu gedit 40k hits or sudo gedit 500k hits. I'm in the minority using the first method but I believe it will become the standard in Ubuntu 17.04.    June 12, 2017 Update Here are a list of errors you get when using pkexec gedit:  (gedit:13003): Gtk-WARNING **: Calling Inhibit failed: GDBus.Error:org.freedesktop.DBus.Error.ServiceUnknown: The name org.gnome.SessionManager was not provided by any .service files  ** (gedit:13003): WARNING **: Set document metadata failed: Setting attribute metadata::gedit-spell-enabled not supported  ** (gedit:13003): WARNING **: Set document metadata failed: Setting attribute metadata::gedit-encoding not supported  ** (gedit:13003): WARNING **: Set document metadata failed: Setting attribute metadata::gedit-position not supported   On this  there is a commitment to fix these distracting messages as of June 5, 2017. No indication is given for when the fix will be upstream nor if the functionality will be implemented or the error messages will simply disappear.  Note the bug report was filed over a year ago and over that time it only effects 18 people. Infinite series $\sum _{n=2}^{\infty } \frac{1}{n \log (n)}$ Multiple Installations and Understanding $PATH I have an older version of Git installed at:  /usr/bin/   I recently downloaded a newer version to:  /usr/local/bin   When I type:  which git   I get the location of the old version. I believe that this is just because /usr/bin/ appears before /usr/local/bin in my $PATH variable and so the older version of git is 'found' first.   To test this, I renamed the older version of git to "git_old". Now when I type:  which git   I get the location of the newer version, as expected. But when I type:  git --version   I get the following error:  -bash: /usr/bin/git: No such file or directory   I'm just wondering why my computer is going back to looking in the old location for Git? Example of a recursive set $S$ and a total recursive function $f$ such that $f(S)$ is not recursive? Browsing wikipedia, I stumbled on the following: "The image of a computable set under a total computable bijection is computable." Given the form of the theorem, there must be some example of a example of a recursive set $S$ and a total recursive function $f$ such that $f(S)$ is not recursive (otherwise the statement would have presumably been stronger). But I'm having difficulty dreaming up a case where this happens. The kernel and range of the powers of a self-adjoint operator The category Set has the property that any morphism f can be decomposed into an epimorphism $e$ and a monomorphism $m$ with $f$ = $m\circ e$. (The intermediary set object is the image of $f$.)  Is there a name for this construction?  Is there a name for this property of categories?  In Set, the intermediary object is unique up to isomorphism. Is this the case for all categories with the property? What is this rhetorical scheme or literary device called? I can't recall the name of the rhetorical scheme or literary device involved with using the same word more than once within the same sentence but with different meanings:  "The only thing we have to fear is fear itself."    fear - verb fear - noun   "Turn right right here."   right - adv. directional right - adv. in this place   "My feet are but feet away."   feet - noun lower appendage feet - noun distance Which livestock is the most efficient food source? How to extend my root (/) partition? Till today I was using ubuntu 13.04 in my windows7/ubuntu dual boot. Just now I have upgraded to ubuntu 14.04. My software updater showed an updates available message. I proceeded with  Install Now . Soon I got the following window.    Then I tried sudo apt-get clean as recommended. Nothing happened! Not even a window opened. Teach me deleting the temporary packages.   Deleting temporary files may not be highly helpful in case of further updates and installs for I don't have too much space left in my /. I wanna extend my / partition with the help of the unallocated space in my HD. The following is my Gparted window.       I got an answer . But it wasn't useful for me. I had two choices. But the answer wasn't working for both my chioces.  Choice 1: I may use the 4.25 GiB unallocated space to extend my /dev/sda10. To do so, I must need to move my linux-swap partition. But my Resize/Move option is disabled for the linux-swap partition. Choice 1 failed!   Choice 2: I may use the 14.35 GiB unallocated space instead. In this case I must move more than one partition. /dev/sda4  partition is the first on the list. Even that partition has the same problem. Resize/Move option is disabled. Choice 2 failed!  I am out of choices now.  What shall I do? Help me to extend my / with Gparted. I just watched Planet Hulk. At the end the Hulk ends up with someone seemingly almost as powerful as he is. Are the Hulks (Green, Red, and She-Hulk) able to have children? String concatenation: concat() vs "+" operator Assuming String a and b:  a += b a = a.concat(b)   Under the hood, are they the same thing?  Here is concat decompiled as reference. I'd like to be able to decompile the + operator as well to see what that does.  public String concat(String s) {      int i = s.length();     if (i == 0) {         return this;     }     else {         char ac[] = new char[count + i];         getChars(0, count, ac, 0);         s.getChars(0, i, ac, count);         return new String(0, count + i, ac);     } } Could it be that Goldbach conjecture is undecidable? How should I add users non-interactively? I have a set of users I need to add to a new system as part of a BASH script that preps my server. How can I non-interactively add the user, create their home directory, set the group, and enter a default password?  For example, if I needed to add the following users, how would I go about that?  user: node password: spoon group: ultraMegaPermissions  user:serve password: spoot group: sortaNotMega  user:watcher password: spoogle group: notMega Can open sets and closed sets of $\mathbb{R}^n$ be homeomorphic? Suppose $A$ is an open subset of $\mathbb{R}^n$ considered as a topological subspace. Suppose $B$ is a another susbet of $\mathbb{R}^n$, and under the induced topology, is homeomorphic to $A$.  If $B$ is closed and bounded, then by the Heine-Borel theorem, $B$ is compact as a topological space so $A$ and $B$ cannot be homeomorhpic, because $A$ is not compact. But if $B$ is not bounded, what can be said about $B$, if any? Must $B$ be open, can it ever be closed (let's leave out the only case of being both open and closed--the entire ambient space $\mathbb{R}^n$), or can it be neither open nor closed? Dynamic Table partitioning on a daily basis I have a SQL Server database which contains two tables -- Acks and Logs.  These two tables are related in logic but not in a relational database way. Basically, every message that comes in gets saved in the Log table and, if our server acknowledges it, then that ack gets stored in the Ack table.  We are storing around 5 million Acks and 3 million Logs a day. I am trying to partition these two tables on a daily boundary so that we can easily remove older partitions from the table, and also improve query performance.  I haven't done table partitioning before, so I have been reading some on-line tutorials, however I am stuck on one thing. All the tutorials I have followed seem to manually add filegroups and manually add boundaries.  I want SQL Server somehow to do this daily, and this is what my question is about. I need it to create the new filegroups for the next day, every day at, say, 22:00. Then at 24:00 the inserts should start filling up the new day's partition.  Can anyone point me in the right direction on how to achieve this? Either a comprehensive tutorial or some good old advice will do as well.  My second question: can I somehow apply the same partition function to the two different tables?  They both have a datetime(2) column on which I want to partition, and the same rules  will apply.  How does that then fit in with my filegroups? Do I need a single filegroup for the day? Will each table have a file in that filegroup, or will both tables save to the same file in the filegroup?  Do I have to make a .mdf and .ldf for each filegroup? Or is there still one log file for the entire database? Why does a translation matrix need extra row? Why does the "Unanswered Questions" tab show questions that have answers? Not including stdlib.h does not produce any compiler error!