Query to return substring from string in SQL Server

Posted by Jowie on Stack Overflow See other posts from Stack Overflow or by Jowie
Published on 2013-06-28T02:55:22Z Indexed on 2013/06/28 4:21 UTC
Read the original article Hit count: 128

I have a user defined function called Sync_CheckData under Scalar-valued functions in Microsoft SQL Server. What it actually does is to check the quantity of issued product and balance quantity are the same. If something is wrong, returns an ErrorStr nvarchar(255).

Output Example:

Balance Stock Error for Product ID : 4

From the above string, I want to get 4 so that later on I can SELECT the rows which is giving errors by using WHERE clause (WHERE Product_ID = 4).

Which SQL function can I use to get the substring?

© Stack Overflow or respective owner

Related posts about sql

Related posts about sql-server