sql server - SQL query: convert -


I am trying to read a column from the database using a SQL query. Columns contain empty string or number strings, such as

"" "" 9600 "

I am trying to find the right square query to remove all the numbers and I am getting rid of the vacant places, but I am stuck in. So far I have found SELECT * from the base WHERE is not convert (INT, code)

done in program r (package sqldf)

If all columns are valid integers You can use it:

  select *, dot (code as integer) from IntCode to the base where the code is & lt; & gt; ''  

Use to prevent cases when the field is not a valid number, then

 , select cast, (from the codeN base cross Incutcode applies (when code is not like code \ '^ [^ 0-9]%') then terminate the code) N (codeN) where codeN is not zero  < / Pre> 

UPDATE

to find those rows Yes code is not a valid number,

  SELECT * base where code '% [^ 0-9]%'  

Comments

Popular posts from this blog

java - org.apache.http.ProtocolException: Target host is not specified -

java - Gradle dependencies: compile project by relative path -

ruby on rails - Object doesn't support #inspect when used with .include -