473,473 Members | 1,882 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Assigning value to @cmd gets error - Incorrect syntax near '/'.

19 New Member
This works:

Expand|Select|Wrap|Line Numbers
  1. SELECT CData.value('(/fields/Genres)[1]', 'varchar(255)')FROM Categories WHERE ReqNum = 9281 
  2.  
  3.  
  4.  
This does not:

Expand|Select|Wrap|Line Numbers
  1. DECLARE @cmd varchar (1000)
  2. SET @cmd = 'SELECT CData.value('(/fields/Genres)[1]', 'varchar(255)')FROM Categories WHERE ReqNum = 9281' 
  3.  
I get this error: Incorrect syntax near '/'.

How do I resolve this error?
Feb 18 '14 #1
1 1269
Rabbit
12,516 Recognized Expert Moderator MVP
You need to escape your quotes.
Feb 18 '14 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Amit D.Shinde | last post by:
Hi Experts, i am writting a stored procedure in sql server 7. Its a simple stored procedure It is my first stored procedure. I want insert a record in table if the primary key field user id...
11
by: Mark Findlay | last post by:
Hello Experts! I am attempting to use the OleDbCommand.ExecuteScaler() function within my ASP.NET C# web page to perform a simple validation, but receive the following error: "Incorrect...
1
by: Dax | last post by:
When i insert some values float in a form made with ASP appear an error message like this: Microsoft OLE DB Provider for SQL Server (0x80040E14) Line 1: Incorrect syntax near ','. sql="select...
1
by: mabubakarpk | last post by:
HI. I am using SQL Server 2000. I generate a script of some table from EmpDB database when I run script in query analyzer it return error "Incorrect syntax near 'COLLATE'." Scripts is ...
0
by: roamnet | last post by:
hi i created database file with .mdf extention ,sql server as a source and use grid view to display data there're no problem in data retrieve and display,but i want to edit it or insert new...
2
by: Mark B | last post by:
When I click the 'Update' button on a ASP.Net 3.5 GridView record, I get an error: Incorrect syntax near 'nvarchar'. Everything else there works OK. Here is the code: <%@ Page...
1
by: Mia Archibald | last post by:
SELECT mcr2008.st, (SUM(mcr2008.bedsize)-SUM(mcr2007.bedsize))/SUM(mcr2007.bedsize) FROM ( ( SELECT mcrid, st , SUM(bedsize) as bedsize FROM MCRCR_96_to_08 WHERE...
2
by: silwar | last post by:
Hi, I have already stored value of author id in list item value while page loads. but when I change index of drop down list to view author information error is shown. I tried to debug using check...
2
by: juhii3102 | last post by:
protected void btn_Edit_Click(object sender, EventArgs e) { Panel1.Visible = true; Button5.Visible = true; if (FileUpload1.HasFile) { //string...
1
by: JohnFlores424 | last post by:
Hy, I have wrote in asp.net the next code: using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.