Solved

NVARCHAR not recognized built-in function name

Posted on 2014-07-24
2
1,024 Views
Last Modified: 2014-07-24
I'm writing some code that is from a lesson.  I've added a field to a table as xml.  In VS2010, I run my app and the gridview doesn't show up, it does throw and error and it seems to be in SQL.  I'm trying to show the data as nvarchar.  Here's the select statement used.

SELECT id, date_added, comment, application_name,extra_data.value('(/data/@username)[1]', nvarchar(100)) as username FROM ApplicationLog WHERE Application_Name = @appname


I haven't been able to find anything that talks about what is needed to fix it.  I'm just learning the development aspect of things here at work.  Help is greatly appreciated.  Thanks
Sherry
0
Comment
Question by:Sherry
2 Comments
 
LVL 22

Accepted Solution

by:
Snarf0001 earned 250 total points
ID: 40218278
You have to wrap the datatype in single quotes as well (passing it as a string):

SELECT id, date_added, comment, application_name,extra_data.value('(/data/@username)[1]', 'nvarchar(100)') as username FROM ApplicationLog WHERE Application_Name = @appname
0
 

Author Closing Comment

by:Sherry
ID: 40218292
Perfect, thank you.  I thought it would be something simple like that.
0

Featured Post

Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

A short article about problems I had with the new location API and permissions in Marshmallow
In this article we will get to know that how can we recover deleted data if it happens accidently. We really can recover deleted rows if we know the time when data is deleted by using the transaction log.
An introduction to basic programming syntax in Java by creating a simple program. Viewers can follow the tutorial as they create their first class in Java. Definitions and explanations about each element are given to help prepare viewers for future …
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question