Is there any way to convert a text field to a number field and drop any data
that has an alpha character in it? I am able to override the message in
Access but I am not sure if you can in SQL.
For ex.
"1234AB" Don't want this data
"123456" Want this data
Thanks,
LisaIf the numbers are positive integers, then try:
use northwind
go
create table t (
colA varchar(25)
)
go
insert into t values('1234AB')
insert into t values('123456')
go
delete t where patindex('%[^0-9]%', colA) > 0
go
alter table t
alter column colA int
go
select * from t
go
drop table t
go
if not, use the functions from this link.
What is wrong with IsNumeric()?
http://www.aspfaq.com/show.asp?id=2390
AMB
"Barce5" wrote:
> Is there any way to convert a text field to a number field and drop any da
ta
> that has an alpha character in it? I am able to override the message in
> Access but I am not sure if you can in SQL.
> For ex.
> "1234AB" Don't want this data
> "123456" Want this data
> Thanks,
> Lisa
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment