Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Database > SQL Language
|
SQL Language SQL Language discussions not specific to a particular RDBMS program or vendor.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the SQL Language section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old February 15th, 2012, 09:09 AM
Authorized User
 
Join Date: Oct 2010
Posts: 71
Thanks: 12
Thanked 0 Times in 0 Posts
Default SQL Syntax doesn't work in MS 2008

Hi guys,

I am using Management Studio 2008 and trying to write a query using FOR XML PATH. But the the word PATH is throwing an error! Here is my code:

Code:
SELECT Id, Name AS "Submitters Name", SubmissionDate AS 'Submission Date', Book, ChangeName AS 'Change Name', ModificationChange AS 'Modification / Change', Priority, Month

FROM [dbo].[ChangeRequest]
  FOR
  XML PATH
The error is throws is here:

Code:
Msg 170, Level 15, State 1, Line 6
Line 6: Incorrect syntax near 'PATH'.
ANy thoughts as to why? I am using the book MSSQL Server 2008 Programming and this uses the code above. So why doesn't it work on my MSSQL MS?

Best

Lee

Last edited by leeWozyWarren; February 15th, 2012 at 09:12 AM.. Reason: addition
 
Old February 18th, 2012, 02:53 AM
Friend of Wrox
 
Join Date: Nov 2009
Posts: 156
Thanks: 13
Thanked 16 Times in 16 Posts
Smile

Hi there.

xml tags can't contain spaces.

try this one:
Code:
SELECT Id, Name AS [SubmittersName], SubmissionDate AS [SubmissionDate], Book, ChangeName AS [ChangeName], ModificationChange AS [ModificationOrChange], Priority, Month

FROM [dbo].[ChangeRequest]
  FOR XML PATH
__________________
happy every time, happy every where

Reza Baiat

Last edited by irProject; February 18th, 2012 at 02:57 AM..
The Following User Says Thank You to irProject For This Useful Post:
leeWozyWarren (February 18th, 2012)
 
Old February 18th, 2012, 02:55 AM
Friend of Wrox
 
Join Date: Nov 2009
Posts: 156
Thanks: 13
Thanked 16 Times in 16 Posts
Smile

Hi again

see the following link:

http://geekswithblogs.net/chavansach...30/112132.aspx
__________________
happy every time, happy every where

Reza Baiat
The Following User Says Thank You to irProject For This Useful Post:
leeWozyWarren (February 18th, 2012)
 
Old February 18th, 2012, 05:02 PM
Authorized User
 
Join Date: Oct 2010
Posts: 71
Thanks: 12
Thanked 0 Times in 0 Posts
Default

Thanks so much for the advice. It works now. So simple an answer too! Cheers!

Lee





Similar Threads
Thread Thread Starter Forum Replies Last Post
Has anyone got this working with VWDE 2008 / SQL Express 2008? john77 BOOK: ASP.NET 3.5 Website Programming Problem Design Solution 4 January 18th, 2010 01:16 PM
Link a Linux MySQL DB to MS-SQL 2008 4thhorseman SQL Server 2008 1 December 9th, 2009 10:32 AM
Visual studio 2005(32 bit) code not work in visual studio 2008 on windows server 2008 gr8.jain Visual Basic 2008 Essentials 1 August 31st, 2009 10:07 AM
ms sql syntax allang SQL Server 2000 1 November 3rd, 2003 06:12 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.