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 |
haroon2k9
Constraint Violating Yak Guru
328 Posts |
Posted - 2010-11-02 : 02:05:12
|
hi ,tbl name :Detailstblcolumn - id(int),hdcasename :varchar(255)id hdcasename1 test2 tree3 schooljust do the search by id or hdcasename is the parameter..example searchparam : hd-001 (input param)result :id hdcasename1 tesinput can be : testresultid hdcasename1 testthis is all abt the req(inbput param can be id prefixed by hd-001 or 01 or 1 or te or t or tes or test)..pl help me.. |
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2010-11-02 : 03:36:55
|
So do you want to use same parameter for both id and hdcasename columns?MadhivananFailing to plan is Planning to fail |
 |
|
haroon2k9
Constraint Violating Yak Guru
328 Posts |
Posted - 2010-11-02 : 03:48:17
|
YES MADI |
 |
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2010-11-02 : 04:21:25
|
where (id=replace(@searchparam,'hd-','')*1 or hdcasename =@searchparam)MadhivananFailing to plan is Planning to fail |
 |
|
Sachin.Nand
2937 Posts |
Posted - 2010-11-02 : 04:32:56
|
quote: Originally posted by haroon2k9 hi ,tbl name :Detailstblcolumn - id(int),hdcasename :varchar(255)id hdcasename1 test2 tree3 schooljust do the search by id or hdcasename is the parameter..example searchparam : hd-001 (input param)result :id hdcasename1 tesinput can be : testresultid hdcasename1 testthis is all abt the req(inbput param can be id prefixed by hd-001 or 01 or 1 or te or t or tes or test)..pl help me..
Why cant you have 2 parameters?One for id and one for name?PBUH |
 |
|
haroon2k9
Constraint Violating Yak Guru
328 Posts |
Posted - 2010-11-02 : 05:56:19
|
quote: Originally posted by madhivanan where (id=replace(@searchparam,'hd-','')*1 or hdcasename =@searchparam)MadhivananFailing to plan is Planning to fail
Working as expected..thanks..can you pl explain me what is that *1 do?please |
 |
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2010-11-02 : 06:06:08
|
It convert the varchar 001 to int 1MadhivananFailing to plan is Planning to fail |
 |
|
haroon2k9
Constraint Violating Yak Guru
328 Posts |
Posted - 2010-11-02 : 09:15:06
|
thanks.sorry for the dealyed reply.. |
 |
|
|
|
|