top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

I want to append output data from a query into an existing file, which command prompt tool will help me?

+3 votes
646 views
I want to append output data from a query into an existing file, which command prompt tool will help me?
posted Mar 29, 2014 by Neeraj Pandey

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

0 votes

1) You can use SQLCMD to output to a file something like

sqlcmd -Q "Your Query" -o testresults.txt

2) To make it append u can try something like

copy finalresult.txt + testresults.txt  finalresult.txt 
del testresults.txt
answer Mar 29, 2014 by Salil Agrawal
Similar Questions
0 votes
for($i=0;$i<=feof($getdata);$i++)
{
if (filter_var($data[$i][1], FILTER_VALIDATE_EMAIL)){
echo $data[$i][1];
$email=$data[$i][1];
$conn = mysqli_connect($dbhost,$dbuser,$dbpass, $dbname);
if ($conn->connect_error) {
  die("Connection failed: " . $conn->connect_error);
}
$sql ="INSERT INTO promo_user (uid,name,email) VALUES (,'', '$email')";
mysqli_query($sql,$conn);
mysqli_close($conn);

I am using the above code but there is something wrong with it,whenever i run the code the echo is working fine but the content does go into sql table

Please help

...