how to select first 9 numbers from other table from database using sql query?
If I understand correctly your requirement, this should do the trick:

WITH MAINFILE (facno) AS (
    SELECT '010000101000001'
),
GLMAST (fglcode) AS (
    SELECT '010000101'
)
SELECT MAINFILE.facno --,GLMAST.fglhead   
FROM MAINFILE   
INNER JOIN GLMAST 
    ON MAINFILE.facno LIKE GLMAST.fglcode + '%'
    --and GLMAST.fglhead='" &amp; ComboBox2.Text &amp; "' "


Please note that the predicate on GLMAST.fglhead is prone to SQL injection. I strongly suggest to rewrite this code in a more secure way.