SET fso = CreateObject("Scripting.FileSystemObject"
Do while not ptr_file.AtEndOfStream
my_line = ptr_file.ReadLine
Loop
ptr_file.close
SET fso = Nothing
You can do what you want on the my_line variable or use the ReadAll methods instead of ReadLine.
I hope i help you
------------
Jens Nilsson at 11/16/00 7:24:31 AM
Hello!
Dose anyone know how I can read a text file. I need that info to have in the subject when I use the xp_sendmail.
Grettings!
/Jens
Databas Administrator
Malmoe - Sweden
I TRIED THIS CODE AND DID NOT WORK PLS DESCRIBE IN DETAIL PLEASE.
1. WHETHER THIS COULD BE USED IN TSQL OR NOT
------------
ratatouil at 11/16/00 8:58:20 AM
SET fso = CreateObject("Scripting.FileSystemObject"
Do while not ptr_file.AtEndOfStream
my_line = ptr_file.ReadLine
Loop
ptr_file.close
SET fso = Nothing
You can do what you want on the my_line variable or use the ReadAll methods instead of ReadLine.
I hope i help you
------------
Jens Nilsson at 11/16/00 7:24:31 AM
Hello!
Dose anyone know how I can read a text file. I need that info to have in the subject when I use the xp_sendmail.
Grettings!
/Jens
Databas Administrator
Malmoe - Sweden
Ok so it's not the complete code but only short example.
So the SET fso = CreateObject("Scripting.FileSystemObject"
is needed.It's the main object : it contain the open,close,delete methods
Then comes the Set ts = fso.OpenTextFile("c: estfile.txt", 1)
I forgot this line I'm sorry about this
So this line is to set the cursor on the open file.The 1 is the ForReading option.The comes the loop :
Do while not ptr_file.AtEndOfStream
my_line = ptr_file.ReadLine
Loop
It means that it will loop until the end of file.In each loop it store the line read in the my_line variable.
One last thing : my_line , fso , ts are variable and must be declared.
Oh yes i forget : This is not Tsql but Vbscript so you write this code in a DTS.
------------
LILLY at 11/17/00 1:17:22 AM
I TRIED THIS CODE AND DID NOT WORK PLS DESCRIBE IN DETAIL PLEASE.
1. WHETHER THIS COULD BE USED IN TSQL OR NOT
------------
ratatouil at 11/16/00 8:58:20 AM
SET fso = CreateObject("Scripting.FileSystemObject"
Do while not ptr_file.AtEndOfStream
my_line = ptr_file.ReadLine
Loop
ptr_file.close
SET fso = Nothing
You can do what you want on the my_line variable or use the ReadAll methods instead of ReadLine.
I hope i help you
------------
Jens Nilsson at 11/16/00 7:24:31 AM
Hello!
Dose anyone know how I can read a text file. I need that info to have in the subject when I use the xp_sendmail.
Grettings!
/Jens
Databas Administrator
Malmoe - Sweden