A SIMPLE XML EXTRACT USING SQL SERVER 2000
"SELECT...FOR XML AUTO, ELEMENTS"
 
 

The SQL connection string is ="SELECT * from glmaster FOR XML AUTO, ELEMENTS"

Note: The connection is OLEDB NOT DSN.

MS SQL Server 2000 returns 1 nested tag per table row where:

  1. the outside tag is the table name
  2. each table row's "SELECTED" columns appears as a tag pair with the column data as content
  3. there is NO overall outside tag
    (Note: You have to add one to use the XML DOM on the client side)

The XML is returned to the client as an XML data island and rolled out through javascript using the XML DOM.
NOTE: The roll out is not recursive since the "XML AUTO" will only return two levels.

Click "VIEW", then "SOURCE" to see the XML data island and the javascript XMLDOM rollout Execution begins...

1000100000Cash Operating Houston B and T AN 213-765-91679531000200000Cash Payroll Houston B and T AN 213-765-8461781000300000Cash Field Houston B and T AN 213-765-712601000400000Cash Petty Houston B and T AN 213-765-67001100100CD 3456-8765-1 11-22-971000001100200CD 3456-8766-1 12-21-971000001300100000Acct Recv Credit Master Inc., Omaha Nebraska1837651300200000Acct Recv EuroCard, Ltd., London, England463201300300000Acct Recv PacCard, Inc, Tokyo, Japan1132321700100000Furniture and Fixtures234501700200000Copier Xerox 4455676-98f45301800100000Accum Depreciation -- Furniture and Fixtures-125431800200000Accum Depreciation -- Copier-11501900100000Prepaid Rent01900200000Prepaid Insurance01900300000Prepaid Interest01900900000Other Assets47602000100000Accounts Payable-32402000200000Notes Payable-1485322400100000FIT Payable02400400000FICA Payable02400500000Federal Withholding Payable02500100000Texas Sales Tax Payable-90002600100000Insurance Withholding02600200000Credit Union Withholding02600300000Union Dues Withholding03000100000Common Stock-5000003000200000Preferred Stock03000300000Treasury Stock03000400000Capital Contributions03000500000Paid in Capital in excess of Par-200003000600000Earnings-967084000100000Fees04000200000Claims04000300010000Capt Webb Internet Store Revenues04000300020000Houston Walk-in Store Reevnues04000300030000Catalog Revenues05000100010000Direct Labor - Internet Store Operations05000100020000Direct Labor - Walkin Store Operations05000100030000Direct Labor - Catalog Operations06000100010000Direct Labor - Maintenance Internet Store06000100020000Direct Labor - Maintenance Walk-in Store06000100030000Direct Labor - Maintenance Catalog07000100010000Direct Labor - Supervisory Internet Store07000100020000Direct Labor - Supervisory Walk-in Store07000100030000Direct Labor - Supervisory Catalog08000100010000Direct Labor - Parttime Internet Store08000100020000Direct Labor - Parttime Walk-in Store08000100030000Direct Labor - Parttime Catalog Store09000100000Office Lease09000200000Auto and Travel Expenses09000300000Dues and Subscriptions09000400000Insurace Exepnse09000500000Office Supplies09000600000Telephone Expenses09000700000Electrical Expenses09000800000Water and Garbage09000900000Gas09100100000Interest Expense09999999900SUSPENSE-975

Click here for the source code