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 |
|
Arun.G
Yak Posting Veteran
81 Posts |
Posted - 2010-07-27 : 09:05:30
|
| THE BELOW IS MY STOREDPROCEDURE:CREATE PROCEDURE [dbo].[SP_RES_SEARCH]-- The below are the input arguments for calling the procedure@EMP_NAME varchar(100)ASSELECT UPPER(FIRSTNAME) FROM DATATABLE WHERE FIRSTNAME LIKE '@EMP_NAME %'this executed successfully, but not displyaing the outputbut i used the same query and instead of @emp_name=Ameans , its working finehow should i give the input argument in like condition?i tried this@EMP_NAME + '%''', but not workingpls help.SELECT UPPER(PI_FIRSTNAME) FROM PNET_PFILE_DATATABLE1 WHERE PI_FIRSTNAME LIKE 'A%' then it display firstanem starting as "A" |
|
|
Sachin.Nand
2937 Posts |
Posted - 2010-07-27 : 09:13:02
|
Create dynamic SQL like this@sql='SELECT UPPER(FIRSTNAME) FROM DATATABLE WHERE FIRSTNAME LIKE' + @EMP_NAME + '%'Exec(@sql) Limitations live only in our minds. But if we use our imaginations, our possibilities become limitless. PBUH |
 |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2010-07-27 : 09:14:27
|
[code]SELECTUPPER(FIRSTNAME)FROMDATATABLEWHEREFIRSTNAME LIKE @EMP_NAME + '%'[/code] KH[spoiler]Time is always against us[/spoiler] |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2010-07-28 : 06:43:41
|
quote: Originally posted by Idera Create dynamic SQL like this@sql='SELECT UPPER(FIRSTNAME) FROM DATATABLE WHERE FIRSTNAME LIKE' + @EMP_NAME + '%'Exec(@sql) Limitations live only in our minds. But if we use our imaginations, our possibilities become limitless. PBUH
You dont need a dynamic sql as you dont pass any object names as variablesMadhivananFailing to plan is Planning to fail |
 |
|
|
|
|
|