In this article, we learn about SQL Server database functions, and using these functions gets the numeric value from a string value. Most useful functions when we develop applications database like profile related employees code generation, etc.
SQL Server function for get numeric value from a string:
CREATE FUNCTION GetNumericFromString(@StringValue VARCHAR(256)) RETURNS VARCHAR(256) AS BEGIN DECLARE @NumericValue INT SET @NumericValue = PATINDEX('%[^0-9]%', @StringValue) BEGIN WHILE @NumericValue > 0 BEGIN SET @StringValue = STUFF(@StringValue, @NumericValue, 1, '' ) SET @NumericValue = PATINDEX('%[^0-9]%', @StringValue ) END END RETURN ISNULL(@StringValue,0) END;
Call function for getting numeric value from a string:
DECLARE @StringValue VARCHAR(256)='EMPZP20'; SELECT dbo.GetNumericFromString(@StringValue);
What an extremely wonderful post this is. Genuinely, perhaps the best post I've at any point seen to find in as long as I can remember. Goodness, simply keep it up.
ReplyDelete360DigiTMG supply chain analytics course
I'm cheerful I found this blog! Every now and then, understudies need to psychologically the keys of beneficial artistic articles forming. Your information about this great post can turn into a reason for such individuals.
ReplyDeletehttps://360digitmg.com/course/certification-program-in-data-science
Through this post, I realize that your great information in playing with all the pieces was exceptionally useful. I advise this is the primary spot where I discover issues I've been scanning for. You have a smart yet alluring method of composing.
ReplyDeletedata science course in noida
Especially superb!!! Exactly when I search for this I found this webpage at the top of every single online diary in web crawler.
ReplyDelete360DigiTMG
This post is very simple to read and appreciate without leaving any details out. Great work!
ReplyDeletedata analytics training aurangabad