Solved

NVARCHAR not recognized built-in function name

Posted on 2014-07-24
2
988 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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Entering time in Microsoft Access can be difficult. An input mask often bothers users more than helping them and won't catch all typing errors. This article shows how to create a textbox for 24-hour time input with full validation politely catching …
Whether you’re a college noob or a soon-to-be pro, these tips are sure to help you in your journey to becoming a programming ninja and stand out from the crowd.
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
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…

707 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now