Wrox Programmer Forums
|
SQL Server 2000 General discussion of Microsoft SQL Server -- for topics that don't fit in one of the more specific SQL Server forums. version 2000 only. There's a new forum for SQL Server 2005.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the SQL Server 2000 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 March 17th, 2006, 09:30 AM
Friend of Wrox
 
Join Date: Oct 2005
Posts: 173
Thanks: 0
Thanked 2 Times in 1 Post
Default Wildcard on nText field

Hi All

I am creating what I though to be a simple search function. I am using asp.net2 (VB) as my from end which pass some parameters into an stored procedure and what I am trying to do is concatenate 2 wildcards (%) either side of my parameter rather than the user adding the wildcards.

Here is what I thought would work but it give me the error:

invalid operator for data type. Operator equals add, type equals ntext

Code:

Code:
@field1param ntext

AS

SELECT * FROM Table1 WHERE Field1 LIKE '%'+@field1param+'%'
I am pretty new to all of this still and sometime make things up as I go along.. this being the case with the above.

Can anyone one see where I am going wrong or suggest an alternative?

Ta

Rit
__________________
Rit
www.designandonline.co.uk
INSPIRE | CREATE | DELIVER
 
Old March 17th, 2006, 12:48 PM
Authorized User
 
Join Date: Oct 2005
Posts: 72
Thanks: 0
Thanked 0 Times in 0 Posts
Default

You have to change the data type of your @field1param from ntext to nvarchar because the string concatenation operator (+) is not allowed on text/ntext data types.

SQL Server Helper
http://www.sql-server-helper.com





Similar Threads
Thread Thread Starter Forum Replies Last Post
DISTINCT ntext Values fleming SQL Server 2000 2 July 23rd, 2005 06:58 PM
How to Search in nTEXT or TEXT field gaupa SQL Server 2000 1 December 21st, 2004 07:48 AM
Regarding Inserting values to ntext field Hari_Word ADO.NET 1 August 31st, 2004 05:15 PM
Can't pull data from ntext field into recordset. rstelma SQL Server 2000 2 August 26th, 2003 04:50 PM
Can't pull data from ntext field into recordset. rstelma Classic ASP Databases 1 August 26th, 2003 03:21 PM





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