Solved

NVARCHAR not recognized built-in function name

Posted on 2014-07-24
2
1,049 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

NFR key for Veeam Backup for Microsoft Office 365

Veeam is happy to provide a free NFR license (for 1 year, up to 10 users). This license allows for the non‑production use of Veeam Backup for Microsoft Office 365 in your home lab without any feature limitations.

Question has a verified solution.

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

Suggested Solutions

Displaying an arrayList in a listView using the default adapter is rarely the best solution. To get full control of your display data, and to be able to refresh it after editing, requires the use of a custom adapter.
Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…

821 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