Hi
Can any body tell me wt's the Access Val() function in T-SQL. Like there is a str() funtion but i can'r find a val() function. Plz mention any other solution aprt from Cast and Convert functions.
As such there is no function under SQL 7 which duplicates the val() function, If you need to find a Numeric value in a string then u can use
CHARINDEX to find the starting position of the numeric value in a string and use SUBSTRING to retrieve one value at a time.
sorry i don't have SQL code right now, but here is a java script that i wrote to check numbers in a field. U can use the same logic if you want to!
function numcheck(num)
{
var checkok="0123456789";
var numcheck=num;
var numvalid=true;
var ch="";
for (i=0; i < numcheck.length; i++)
{
ch=numcheck.charAt(i)
for (j=0; j < checkok.length; j++)
{
if (ch==checkok.charAt(j))
break;
}
if (j==checkok.length)
{
numvalid=false;
break;
}
}
return numvalid;
}
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.