SQL query problem when importing a series set of documents

Hi, I'm very new to SQL and have an issue I'm looking for help with.

I have a series of documents that are part of a version set of 12

I am using a tracking table in SQL to import the docs into my system to maintain the original version numbers.

The "new" version numbers get scrambled because I think the query cannot make the distinction between doc "1" and doc "10" and doc "11"

I think the subquery "newdocnumber" <> is the issue.

Is there a specific quer I can substitute that can make the necessary two decimal distinction so that a family of doc versions that goes past version "9" does not run into this difficulty?

Any ideas would help!!

G

I assume version is some type of varchar field?
Can you change that to decimal or could there be versions such as 10.1A

why not use FILESTREAM or File Tables or even Remote BLOB Storage if you're on SQL Server 2017