Echo Sql Which Has Been Run
Jul 20, 2005
I am relatively new to SQL Server.
I have a command file with the following contents :
osql -E -i%1.sql -d%2 -oq:\%1.log
The sql script file has a number of insert/update statements.
The log file produced looks something like this :
1> 2> (1 row affected)
1> 2> (1 row affected)
1> 2> (0 rows affected)
Is there any setting which can be turned on such that the log file
produced from this command file will echo the statement and then
the number of rows which are affected.
TIA.
View 1 Replies
Jul 10, 2014
I am trying to echo the sum of a column from a table.
$result = mysql_query("
SELECT SUM(columnname) FROM tablename
");
{
echo $result;
}
I've copied various methods from various other bits of code I've seen, and I just cannot get it to work.
View 1 Replies
View Related
Mar 11, 2008
I know you can start SQLCMD with the -e option to have the SQL code echoed in the output when running. Is there a way to turn this on or off within a script file?
Example:
File1.sql = select 'hi' as HI
go
File2.sql = select 'by' as BY_
go
Runfile.sql =
set (like echo on, -e sign on parm) ? what command
:r File1.sql
set (like echo off, -e sign on parm not used) ? what command
:r File2.sql
want to get output like
select 'hi' as HI (echoed the select statement)
HI
--
hi
(1 rows affected)
BY_ ( did not echo the select statment)
---
by
View 1 Replies
View Related