tsql - Strip off any characters from a string in SQL Server -


I am trying to write a stored procedure that will give the next value on the line.

In my case, I am sending a reference number and stored procedure MIN and & gt; Returns the next ref number using . However, the ref table contains 123GF, 256ER, 25GD characters, which gives me an error in converting from Varchar to int .

How do I touch any non-numerical number before comparing the value with my passing value?

This is my current process code:

  Create process [dbo] .nxprevious @refId integer, @Next on NOCOUNT set as the next bit; Select the @lReturn integer IF (@Next = 1) from the table REF declaration where REF = (select from the REF table) where REF & gt; @refId select any other from the table REF Where REF = ( Selection of MAX (REF) [REF-REF & LT; @refId] @lReturn = @@ ROWCOUNT Return @lReturn End GO    

If you are using SQLServer, then do the following

 Enter image details here

Another solution is using the function change:

  Select replacement (reference, 'A', '') from the table -         

Comments

Popular posts from this blog

java - ImportError: No module named py4j.java_gateway -

python - Receiving "KeyError" after decoding json result from url -

.net - Creating a new Queue Manager and Queue in Websphere MQ (using C#) -