Sql String Functions Substring Javascript