alter procedure usp_Summation360Consumptionas begin SELECT top 100 [AccountNum] ,[MTU] ,[Port] ,[WaterConsumption4] ,[Name] ,[Address1] ,[CutOffdt] ,[RunDate] FROM Consumption360-- where AccountNum = '000112182'for xml path ('AccountNum'), root('Account'), type end
maybe syntax wise was not accurate but here is what im trying:
SELECT [AccountNum] ,[Name] ,[Address1] (SELECT [MTU] ,[Port] ,[WaterConsumption4] ,[RunDate] FROM Consumption360 where AccountNum = '000100226' order by [MTU], [PORT] for xml path ('MTU'), root('METER'), type ) FROM Consumption360 where AccountNum = '000100226' for xml path ('AccountNum'), root('ACCOUNT'), type
If you can't get it quite right, I suggest posting the structure of the table and some sample data. But how close are you now?
COHFL
ASKER
yeah I just notice that =( thanks to point it out.
After I fix that little error on my part I get another error:
Unable to show XML. The following error happened:
Unexpected end of file has occurred. The following elements are not closed: RunDate, MTU, METER, AccountNum, ACCOUNT. Line 1, position 2097154
One solution is to increase the number of characters retrieved from the server for XML data. To change this setting, on the Tools menu, click Options.
I did that and pick the unlimited characters for XML and still does not work =(
Phillip Burton
Have you tried my version? How close is that to what you want?
Phil, I have try your version but it does not break on every MTU and repeats the account number on each entry. Im trying to format the output to break on each account but at the same time break on each MTU
Phillip Burton
I suggest posting the structure of the table and some sample data. Any other experts want to help?
maybe syntax wise was not accurate but here is what im trying:
Open in new window
the idea is that the account info is wrap around on the top and each MTU after but under the same Account