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 |
|
Dipu710646
Starting Member
10 Posts |
Posted - 2010-11-26 : 03:15:22
|
| Hi All,I have a column called EmpName.It contains employee name.It got some values with % .1 Sana123 1 2000 2010-05-05 00:00:00.0002 Sana%123 2 3000 2010-05-05 00:00:00.0003 Sana%123 3 4000 2010-05-05 00:00:00.0004 Sana%123 3 1000 2010-05-05 00:00:00.000I want to fetch these records from table.How will I do that.Please reply..Dipankar Sana |
|
|
webfred
Master Smack Fu Yak Hacker
8781 Posts |
Posted - 2010-11-26 : 03:36:29
|
select * from table where EmpName like '%[%]%' No, you're never too old to Yak'n'Roll if you're too young to die. |
 |
|
|
Lumbago
Norsk Yak Master
3271 Posts |
Posted - 2010-11-26 : 03:41:01
|
| [code]DECLARE @table table ( name varchar(200) )insert into @table select 'Sana%123' UNION ALL SELECT 'Sana123'select * from @table where charindex(CHAR(ASCII('%')), name) > 0[/code]- LumbagoMy blog (yes, I have a blog now! just not that much content yet) -> www.thefirstsql.com |
 |
|
|
nigelrivett
Master Smack Fu Yak Hacker
3385 Posts |
Posted - 2010-11-26 : 04:21:43
|
| select *from tblwhere EmpName like '%/%%' escape '/'==========================================Cursors are useful if you don't know sql.SSIS can be used in a similar way.Beer is not cold and it isn't fizzy. |
 |
|
|
webfred
Master Smack Fu Yak Hacker
8781 Posts |
Posted - 2010-11-26 : 04:37:08
|
select * from tblwhere len(Empname) <> len(replace(Empname,'%','')) No, you're never too old to Yak'n'Roll if you're too young to die. |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2010-11-26 : 10:41:48
|
quote: Originally posted by Lumbago
DECLARE @table table ( name varchar(200) )insert into @table select 'Sana%123' UNION ALL SELECT 'Sana123'select * from @table where charindex(CHAR(ASCII('%')), name) > 0- LumbagoMy blog (yes, I have a blog now! just not that much content yet) -> www.thefirstsql.com
It is as simple asselect * from @table where charindex('%', name) > 0MadhivananFailing to plan is Planning to fail |
 |
|
|
|
|
|