Solved

Searching a nText column using LIKE

Posted on 2004-10-11
1
310 Views
Last Modified: 2012-08-13
Hello,

I have the following stored procedure:
------------------------------------------------------------------------------------------------------------------------
CREATE PROCEDURE [spSearchContent]
      (@userid      [uniqueidentifier],
       @search      [nText])
AS
SELECT     dbo.User_Loc_Relation.user_id, dbo.User_Loc_Relation.location_id, dbo.Content.title_id, dbo.Content.title, dbo.Content.content
FROM         dbo.Content INNER JOIN
                      dbo.User_Loc_Relation ON dbo.Content.location_id = dbo.User_Loc_Relation.location_id
WHERE
       dbo.Content.content LIKE '%' + @search + '%'
GO
------------------------------------------------------------------------------------------------------------------------

But it does not seem to like the WHERE clause.  Where am I going wrong?

Thanks in advance
0
Comment
Question by:rudyflyer
1 Comment
 
LVL 15

Accepted Solution

by:
jdlambert1 earned 150 total points
ID: 12278376
LIKE only works with char, nchar, varchar, and nvarchar datatypes.
0

Featured Post

How Do You Stack Up Against Your Peers?

With today’s modern enterprise so dependent on digital infrastructures, the impact of major incidents has increased dramatically. Grab the report now to gain insight into how your organization ranks against your peers and learn best-in-class strategies to resolve incidents.

Question has a verified solution.

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

Suggested Solutions

Ever needed a SQL 2008 Database replicated/mirrored/log shipped on another server but you can't take the downtime inflicted by initial snapshot or disconnect while T-logs are restored or mirror applied? You can use SQL Server Initialize from Backup…
This article shows gives you an overview on SQL Server 2016 row level security. You will also get to know the usages of row-level-security and how it works
Via a live example, show how to set up a backup for SQL Server using a Maintenance Plan and how to schedule the job into SQL Server Agent.
Viewers will learn how to use the INSERT statement to insert data into their tables. It will also introduce the NULL statement, to show them what happens when no value is giving for any given column.

730 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