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.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 T-SQL

Author  Topic 

Sonu619
Posting Yak Master

202 Posts

Posted - 2011-02-18 : 22:19:40
How i can delete text from file here is sample data
121
can
122
del
a23

How i can delete (can)& (del)& (a) from source file. Thanks for your help.

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2011-02-18 : 22:40:59
[code]
delete yourtable
where isnumeric(col) = 0
[/code]


KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page

Sonu619
Posting Yak Master

202 Posts

Posted - 2011-02-18 : 23:31:08
I really appreciate your prompt reply, Its solve my problem, Just for curiosity how i can delete only (a) from a23 in sql, here is example
a23
345
g56
Go to Top of Page

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2011-02-19 : 01:15:14
use the function here
http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=79083&SearchTerms=fnFilterString


KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2011-02-21 : 03:29:39
quote:
Originally posted by khtan


delete yourtable
where isnumeric(col) = 0



KH
[spoiler]Time is always against us[/spoiler]




Isnumeric() is not fully reliable

select isnumeric('12d3')

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

MIK_2008
Master Smack Fu Yak Hacker

1054 Posts

Posted - 2011-02-21 : 04:59:31
Check if this works for you

delete from tableName where ColName like '%^[0-9]%'

Cheers
MIK
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2011-02-21 : 05:31:04
quote:
Originally posted by MIK_2008

Check if this works for you

delete from tableName where ColName like '%^[0-9]%'

Cheers
MIK


OP wants to remove only characters and not all data
http://beyondrelational.com/blogs/madhivanan/archive/2010/04/22/extracting-numbers-part-2.aspx

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -