It should be:
...
WHERE LastName LIKE '%' + @LastName + '%';
Instead of:
...
WHERE LastName LIKE '%@LastName%'
More Related Contents:
- to select all the employees who have joined most recently under king
- T-SQL split string
- Unpivot with column name
- How can I get column names from a table in SQL Server?
- Conditional WHERE clause in SQL Server
- How can I select the first day of a month in SQL?
- How to group time by hour or by 10 minutes
- Multi-statement Table Valued Function vs Inline Table Valued Function
- Convert varchar into datetime in SQL Server
- Select statement to find duplicates on certain fields
- Check if a row exists, otherwise insert
- T-SQL datetime rounded to nearest minute and nearest hours with using functions
- Convert Xml to Table SQL Server
- How to create a PivotTable in Transact/SQL?
- Script to kill all connections to a database (More than RESTRICTED_USER ROLLBACK)
- Cannot use a CONTAINS or FREETEXT predicate on table or indexed view because it is not full-text indexed
- How does this CASE expression reach the ELSE clause?
- TransactSQL to run another TransactSQL script
- Store multiple bit values in a single table column
- Which SQL query is faster? Filter on Join criteria or Where clause?
- SQL Server equivalent to MySQL enum data type?
- Generate all combinations in SQL
- Grant SELECT permission on a view, but not on underlying objects
- How can I group by date time column without taking time into consideration
- Using IF ELSE statement based on Count to execute different Insert statements
- Average of multiple columns
- COALESCE Function in TSQL
- Execute sp_executeSql for select…into #table but Can’t Select out Temp Table Data
- Using CASE Statement inside IN Clause
- Select rows where column value has changed