How can I extract values from varchar in SQL ? Ex 'San Jose, St Street, NY, 97'

I want to extract values from a varchar in sql ! Eg 'San Jose, St Street, NY, 97' the values are supposed to assigned in 3 parameters like @Name, @Address, @CodeNo

15th Aug 2020, 12:49 PM
Vivek Jadhav
Vivek Jadhav - avatar
1 Answer
+ 1
You can extract and display the values separately using the SUBSTRING(). Select SUBSTRING(column_name,1,8) from table_name; This would give you just the name 'San Jose'. You can similarly do it for the rest of the string. Also read about the substring() to get more clarity.
15th Aug 2020, 1:02 PM
Avinesh - avatar