How to split strings in SQL Server

declare @string nvarchar(50)
set @string='AA,12'

select substring(@string,1,(charindex(',',@string)-1) ) as col1 
, substring(@string,(charindex(',',@string)+1),len(@string) ) as col2![my sql server image which i tried.][1]

if the values in column 1 are always one character long, and the values in column 2 are always 2, you can use the SQL Left and SQL Right functions:

SELECT LEFT(data, 1) col1, RIGHT(data, 2) col2
FROM <table_name>

SELECT substring(data, 1, CHARINDEX(',',data)-1) col1,
substring(data, CHARINDEX(',',data)+1, LEN(data)) col2
FROM table

I know the points has already been given, going to post it anyway because i think it is slightly better

DECLARE @t TABLE (DATA VARCHAR(20))

INSERT @t VALUES ('A,10');INSERT @t VALUES ('AB,101');INSERT @t VALUES ('ABC,1011')

SELECT LEFT(DATA, CHARINDEX(',',data) - 1) col1, 
RIGHT(DATA, LEN(DATA) - CHARINDEX(',', data)) col2
FROM @t