23. June 2009 09:19
By
Roxin
In
MSSQL | weird errors
The weirdest error I got today was this :
- Column name 'DATA()' contains an invalid XML identifier as required by FOR XML; '('(0x0028) is the first character at fault.
This was happening when I was trying to concatenate rows from a column into a single row like this :
1:
2: REPLACE(
4: (
6: SELECT [Name] as [DATA()]
7:
8: FROM ContactPerson
9:
10: WHERE ClientId = dbo.Client.ClientId
12:
13: FOR XML PATH ('') ), ' ', ',') as AllPersonsNames
I eventually found on a web site the answer : it shouldn't be DATA() it should be data()
bfef9b75-60e1-4d46-a284-4b4b45e51e37|5|5.0
Tags: error, mssql