|
-
ny3ranger
Ranger,
"LIKE" requires the wildcard character % to function the way you want it to.
For example,
SELECT *
FROM tblPublisher
WHERE City LIKE 'New %'
... would select all rows where the city starts with "New ".
The SQL in your example would omit the %.
I think you want something like the following (although I am using SQL Server 2005, so I can't test the 2000 code).
declare @LastName varchar(63);
declare @sql varchar(255);
set @adName = 'Jo';
-- and your Lastname line could be
SET @sql = @sql + ' AND Lastname LIKE ' + char(39) + @Lastname + '%' + char(39)
SET works better than SELECT when assigning values to variables.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
|