New answers tagged

3

Sorry, I missed a step in the relationship. Try this version (though Martin's will work as well): SELECT DISTINCT o.section, names= STUFF(( SELECT ', ' + b.Name FROM dbo.TableA AS a INNER JOIN dbo.TableB AS b ON a.AccountId = b.AccountId WHERE a.Section = o.Section FOR XML PATH, TYPE).value(N'.[1]', N'varchar(max)'), 1, 2, '') FROM ...


2

Here is how I used the answer to my question. I'm a great fan of sp_whoisactive. If you don't have that, stop reading; download here. So I've set it up to collect a snap-shot every 10 minutes, like this: DROP TABLE dbo.HESPOmonitoring_output DECLARE @s VARCHAR(MAX) EXEC sp_WhoIsActive @output_column_list = ...


6

I believe you will have to do some XML query work to get that estimated cost. See if this is what you are looking for: ;WITH XMLNAMESPACES (DEFAULT 'http://schemas.microsoft.com/sqlserver/2004/07/showplan') SELECT TOP 1000 st.text ,cp.size_in_bytes ,cp.plan_handle ,QP.query_plan ...


0

You will need to change the syntax to: For XML Auto, Elements); because Row tag name is only allowed with RAW or PATH mode of FOR XML.


6

According to this MSDN article for using FOR XML in SQL Server 2000, "ELEMENTS Specifies that the columns are returned as subelements. Otherwise, they are mapped to XML attributes. This option is supported in AUTO mode only." So, your usage of ELEMENTS with the RAW option isn't supported in SQL Server 2000, but it does work with AUTO. Edit: If you were to ...



Top 50 recent answers are included