Newbie SQL programmer.

Here is my issue.
I have a field, memid, varchar 30. I want to look at positions 1-9. If all are 9 positions are numeric , move those to memssn int field.
Can anyone assist me?

thanks

update tablename set memssn = cast(substring(memid,1,9) as int)
where substring(memid,1,9) like
              replicate('[0-9]',9)
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.