Asterisk In SQL

Jun 30, 2006

I'm trying to creat a search form and want to use the Like clause in my select statement so that a user can enter part of a word rather than the entire word.  When I use this sql I get no results:

SELECT DISTINCT Keyword.CodeID FROM Keyword INNER JOIN Code ON
Keyword.CodeID = Code.CodeID WHERE ((Keyword.Keyword) Like '*ARR*' AND
(Code.ProgLang)='VB.NET') ORDER BY Keyword.CodeID

The problem is with the * .  If I remove the * it works fine.  If I use the code within Access rather than from my aspx code, it works fine.  Is there a work around for this?

View 2 Replies


ADVERTISEMENT

Can A Transfer An Asterisk In A Parameter?

Jan 26, 2008

can I transfer sql characters (e.g. *,+,%,OR,AND etc.)
and other search keywords through a parameter (@example)?

View 5 Replies View Related

Asterisk In Nvarchar Column Type

Apr 1, 2014

Is it ok/possible to use and * in a column that is NVARCHAR type?

View 4 Replies View Related

SQL 2012 :: Variable Returning Asterisk Instead Of Error

Aug 27, 2014

This query was run against a database on 2008 SP3 and 2012 SP2

Here is an example of what I ran

Declare @A_number varchar(5)
Select Top 1 Column_Is_an_int = @A_number
From Our_Main_Table
Where A_Database_Name = 'A database with many records in this table and multiple records in the Column_is_an_int some are more than 5 characters'

Select @A_number
Exec My_Stored_Proc @A_Nmuber

The top result for that database had an integer that was 8 characters including the - sign.

When the query ran I would normally expect it to throw the binary data cannot be truncated error. However in this case it returned a * in the variable which then tried to pass it in to the SP which of course threw a fit.

Once I changed the varchar(5) to varchar(50) it worked perfectly.

View 5 Replies View Related

T-SQL (SS2K8) :: Select Asterisk Not Returning All Columns In UDF

May 13, 2015

I have a UDF with a select * that works fine in one region (DEV) but not another (QC). It's not returning the last 2 columns from the table in QC.I looked at the UDF and it does a fairly simple select:

select a.*
from myTable A

The table is the same in both regions and I did a sp_help on the table to ensure these 2 columns are listed. They are. Also, executing a select * in a query windows does return the final 2 columns from the table in QC. The issue resides in the QC version of the UDF only.

The UDF has already been updated to retrieve all columns by name but I'm curious why this would happen. For some reason I'd just like to know and in case it happens again.

View 5 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved