for-xml-path Questions

4

Solved

I have this query: SELECT DISTINCT f.CourseEventKey, ( SELECT f.Title + '; ' AS [text()] FROM @Facilities WHERE CourseEventKey = f.CourseEventKey ORDER BY f.Title FOR XML PATH('') ) Facili...
Infeudation asked 17/4, 2014 at 17:52

3

Solved

After reading one answer and second answer and the infopage on sqlcmd I still cannot get the following to work. I am trying to query a result into a xml file using a sqlcmd in batch file. The b...
Saprogenic asked 21/6, 2014 at 19:55

7

Hi I am new to for xml I have a query like this SELECT ProjectId, ProjectCode, ProjectName, TechId, -- LocationId, ( SELECT GeoId,PoliticalDivisionId ,GeographicLocationName,IsoCode,...
Forfeiture asked 6/7, 2013 at 14:7

3

Solved

I'm looking to create a comma-separated list of values from a SQL Server 2005 table, just like in JanetOhara's question. I'm using a query similar to the one presented in techdo's answer to the que...
Pseudohermaphroditism asked 26/3, 2013 at 17:30

2

Solved

I have a lot of questions from a survey im using for a pivot table. To collect all the questions to my pivot dynamically im using stuff and for xml path. However it seems like question text > 130 i...
Statics asked 22/8, 2019 at 8:47

3

I want to create a sitemap xml file (including images) directly from the database without another process (like transformation or another trick). My query is: ;WITH XMLNAMESPACES( DEFAULT 'http:...
Headpin asked 10/10, 2012 at 15:56

8

Table is: Id Name 1 aaa 1 bbb 1 ccc 1 ddd 1 eee Required output: Id abc 1 aaa,bbb,ccc,ddd,eee Query: SELECT ID, abc = STUFF( (SELECT ',' + name FROM temp1 FOR XML...
Assembled asked 3/7, 2015 at 17:3

3

Solved

I found a way to combine multiple row's into one row which is comma separated but now I would like to remove the last comma. CREATE TABLE supportContacts ( id int identity primary key, type v...
Industrialize asked 30/10, 2014 at 4:16

2

Solved

I have data that looks like: OrderID CustomerID ItemID ItemName 10000 1234 111111 Product A 10000 1234 222222 Product B 10000 1234 333333 Product C 20000 5678 111111 Product A 20000 5678 222222 Pr...
Oft asked 25/7, 2012 at 21:30

3

Solved

I need to store the text of all of the stored procedures in a database into an XML data type. When I use, FOR XML PATH, the text within in the stored procedure contains serialized data characters l...
Yellowstone asked 13/9, 2016 at 20:58

3

Solved

I have been given an XML document that I want to generate via a SQL script, I've not done something like this and haven't been able to find any examples that can lead me to being able to generate t...
Bogie asked 6/7, 2016 at 13:53

1

Solved

How does the FOR XML PATH ('') clause do its work when concatenating rows in SQL Server? I just want an explanation of how the FOR XML PATH ('') clause works...
Creamer asked 2/2, 2016 at 8:34

1

Solved

I am having a table like this : EmployeeId EmployeeName ItemName 4 Ganesh Key Board 4 Ganesh Processor 1 Jignesh Key Board 1 Jignesh Mouse 1 Jignesh Processor 3 Rakesh Key Board 2 Tejas Key Board ...
Yodle asked 5/5, 2015 at 5:31

2

Solved

I want to nest each of my XML elements. Take the following example: DECLARE @TempTable TABLE ( [Column1] char(10), [Column2] char(10) ); INSERT INTO @TempTable([Column1], [Column2]) VALUES ('s...
Lithiasis asked 10/9, 2014 at 16:34

2

Solved

Hi! Today I learned for xml path technique to concatenate strings in mssql. Since I've never worked with xml in mssql and google hasn't helped, I need to ask you. Let's imagine the default case. ...
Unpaidfor asked 29/12, 2012 at 14:59

1

I have a table like this (Actually it contains more 6000 records) IdIndustry | IndustryCode | IndustryName | ParentId --------------------------------- 1 | IND | Industry | NULL 2 | PHARM | Pharma...
Satterwhite asked 21/11, 2012 at 12:20

1

Solved

I'm trying to group column values by a specific column using FOR XML PATH('') in TSQL. This is the result in both cases (note that the without XML code - ie: SELECT * FROM @xml - is the same as the...
Witching asked 5/4, 2013 at 21:11

2

Solved

I have a table such as: |Date |Name| -------------------- |'20-May-2011'|Bob | |'20-May-2011'|Fred| |'20-May-2011'|Jim | |'21-May-2011'|Bob | |'21-May-2011'|Ed | |'22-May-2011'|Bill| I need a qu...
Caroleecarolin asked 20/5, 2011 at 15:41

1

Solved

I'm building some HTML to be included in the body of an email and sent using sp_send_dbmail. I'd like to right-align some of the columns. Is there an easy way to do this (short of rewriting it usin...
Armament asked 23/9, 2010 at 15:7

1

Solved

This code basically translates characters based on position in one string to the character at the same position in another string and it runs for all rows in the table. When I run this (simplified...
Appleton asked 26/6, 2009 at 21:30
1

© 2022 - 2024 — McMap. All rights reserved.