Skip to main content


Showing posts from May, 2012

Redirecting output from MySQL queries to a file

Use the--teeMySQL command. Login to MySQL with this command:
mysql --user=root --password=root --tee=c:\mysqloutput.txt -h hostname By using the --tee option when invoking MySQL from a command prompt, statements and output can be logged. All the data displayed on the screen is appended to file referenced in the command, in this example -c:\mysqloutput.txt
More advanced usage,
mysql -u root -p --tee=batch5output.txt  --line-numbers -vvv --skip-column-names

comments: -vvv (output the sql scripts as well)

Also, execute notee at  any time you don't want output the following contents and execute tee when you want output log again. Cheers.

T-SQL: return multiple sets of output with Store Procedure and access from coldfusion

Sample query for return multiple type of output from Store Procedure - proved to be a solution  USE [EdPlan_DEV] if OBJECT_ID('EdPlanAdm.sxuSearchSampleProc') is not null
drop proc EdPlanAdm.sxuSearchSampleProc
go CREATE PROCEDURE [EdPlanAdm].[sxuSearchSampleProc]
@filter Nvarchar(1024),
@myoutput int output
-- start of block 2: will return the count of the result --
DECLARE @count_sql Nvarchar(1024);
set @count_sql = N'select @myoutput = count(*) from dbo.sysobjects where id in ( ' + @filter + ');' -- output count of matched data
exec sp_executesql @count_sql,N'@myoutput int OUTPUT',@myoutput output; select * from dbo.sysobjects ; END
GO ColdFusion Codes cfstoredproc procedure="edplanadm.sxuSearchSampleProc" datasource="#sDataSource#" returnCode = "YES">
<cfprocparam type="IN" cfsqltype="CF_SQL_VARCHAR" dbvarname="filter" value="3,5,7">
<cfprocparam type="OUT" cfs…