Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
mike123
Master Smack Fu Yak Hacker
1462 Posts |
Posted - 2007-12-03 : 14:57:03
|
| Hi,I'm attempting to write the below SP, but not sure how to go about integrating the passed parameter into the "LIKE 'text%'" part.can anyone tell me how this should really look?Thanks!mike123CREATE PROCEDURE [dbo].[select_nameOnline_autoPopulator](@nameOnline varchar(15))AS SET NOCOUNT ONSELECT nameOnline FROM tblUserDetails WHERE nameOnline like '@nameOnline%' and active =1 |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2007-12-03 : 14:59:05
|
SELECT nameOnline FROM tblUserDetails WHERE nameOnline like @nameOnline + '%' and active =1 E 12°55'05.25"N 56°04'39.16" |
 |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2007-12-03 : 14:59:25
|
WHERE nameOnline LIKE @nameOnline + '%' AND active = 1 Tara KizerMicrosoft MVP for Windows Server System - SQL Serverhttp://weblogs.sqlteam.com/tarad/ |
 |
|
|
stormcandi
Starting Member
46 Posts |
Posted - 2007-12-03 : 18:31:23
|
| Where nameOnline like (@nameOnline + '%') |
 |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2007-12-03 : 18:45:41
|
quote: Originally posted by stormcandi Where nameOnline like (@nameOnline + '%')
How is that different from what Peter and I posted? You don't need the parenthesis in this situation.Tara KizerMicrosoft MVP for Windows Server System - SQL Serverhttp://weblogs.sqlteam.com/tarad/ |
 |
|
|
mike123
Master Smack Fu Yak Hacker
1462 Posts |
Posted - 2007-12-04 : 04:59:11
|
| thank you !! :) |
 |
|
|
DonAtWork
Master Smack Fu Yak Hacker
2167 Posts |
Posted - 2007-12-04 : 07:18:12
|
| How is that different from what Peter and Tara posted? You don't need the parenthesis in this situation.see, its catching!!! its an epidemic! I better go get some meds for it....[Signature]For fast help, follow this link:http://weblogs.sqlteam.com/brettk/archive/2005/05/25.aspxLearn SQLhttp://www.sql-tutorial.net/ http://www.firstsql.com/tutor.htm http://www.w3schools.com/sql/default.asp |
 |
|
|
|
|
|