yes ppolymorphe is correct this file comes directly from database, its obvious question why I wanna read instead of removing null from database only reasons are
1. I am fetching columns dynamically for each tables below is my code for better understanding
DECLARE @colnm VARCHAR(MAX)
SET @colnm=''
SELECT @colnm = @colnm + CASE WHEN DATA_TYPE in ('numeric','decimal')
THEN + 'ISNULL(' + 'CONVERT(VARCHAR(50),'+'['+ColumnName +']' + ')' +','+' '''''''' '+')' +'as' +'[' + ColumnName + ']'
ELSE + 'ISNULL(' +'['+ColumnName+']'+ ','+' '''''''' '+')' +'as'+ '[' + ColumnName + ']' end +','
FROM #TMP_FINALCOLUMN COMMA
where Comma.TableName = @TBL_NM
SET @CLM_NM =(SELECT LEFT(@colnm,LEN(@colnm)-1))
SELECT 'xp_cmdshell '''+'sqlcmd -S SERVER -d DB_NM'
+ ' -E -Q '+'"'+
+'SET NOCOUNT ON; select ' + @CLM_NM + ' from '
+QUOTENAME(View_name)+'"'+
+ ' '+'-o'+' '
+ '"A:\DUMMY\'+view_name+'.txt" -W -w 1024 -s"|"'+'''' as Query
FROM TABLE_NAME where STAT=1 AND VIEW_NAME = @TBL_NM
2. Still I found some NULLS when i checked randomly in those files.
Any way thanks your responses, I dropped plan of reading files line by line in this case :)