Sql Server - Is there any way to `Concat` nvarchar column in Select Such as `Agregate functions` -
Hello, I have a table, which is called a tag, I have 2 columns in the tag table (question id cover, tag navigator (100))
QuestionID tag -------------- 1 Math 1 Integral 2 physics question I ---- ---------------- 1 2 * 2 What is it? 2 What is the Quantum Role? QuestionID Q & A Tag ---------- ----------- ------- 1 2 * 2 What is it? What are mathematics, integral 2 quantum roles? Physics Do any scalar value function
There are two ways to answer this:
- You can use a query like the other answer, but this is only useful for a table
- Create
clr Total Function for code below (in my code for C #).
This solution for all tables is simple to use and use, only: from table Use the system; Using System.Data; Using System.Data.SqlClient; Using System.Data.SqlTypes; Using Microsoft.SqlServer.Server; Using System.Text; [Serializable] [Microsoft.SqlServer.Server.SqlUserDefinedAggregate (Format. User defined, IsInvariantToDuplicates = false, IsInvariantToNulls = true, IsInvariantToOrder = false, IsNullIfEmpty = true, MaxByteSize = -1] Public Configuration Concat: IBinarySerialize {Public Zero Init () {SB = new stringbiller (); } Public Zero Accumulated (SqlString value) {return (Value.IsNull); If (SB.Langati> 0) SB.Append ("\ n"); SB.Append (value); } Public Zero Merge (Conscious Group) {If (SBLentad> 0 & amp; amp; Group SB.Length & gt; 0) SB.Append ("\ n"); SB.Append (Group.SB.ToString ()); } Public SqlString Finish () {New SqlString (SB. ToString ()); } // This placeholder member is the field stringbinder Sb; Read public null (System.IO.BinaryReader r) {SB = new stringbuilder (r.ReadString ()); } Public Zero Write (System.IO.BinaryWriter w) {w.Write (SB ToString ()); }}
Comments
Post a Comment