Save Print messages

  • I have a script that prints out the count and results for each step using the print command.

    I would like to be able to have it save the rpt automatically at the end using a variable as the name.

    Right now I run the script in query anly. but will be making it stored procedure soon.

    Thanks

  • This was removed by the editor as SPAM

  • May possible ,but better to dump your messages to a log table with update time

  • A log table sounds exactly like what I need.

    I am a newbie and would greatly appreciated it if someone could point me to some info on best practices for creating log tables.

    Thanks

  • I am ready to help you, You please at least the pseudo code of what you supposed to do ,so that I can suggest the structure of log table

  • This is what I created.  Any help to clean this up a bit would be appreciated.

    Thank you

    se Leads

    if object_id('stpDialable_Log_AZ') is not null

     drop proc stpDialable_Log_AZ

    go

    create proc stpDialable_Log_AZ

     

    AS

     

    --------------------------------------------------------------------------

    --------------------------------------------------------------------------

    /*

    Name: stpDialable_Log_AZ

    --------------

    Description:

    --------------

    Inserts entry into dbo.DBOLog_Dialable to record daily dialable statistics based on

    last_disp

    To be run after set status

    Author: Jason Paine

    --------------

    Input Params:

    --------------

     

    Output Params:

    --------------

    Return:

    --------------

    Results:

    --------------

    Locals:

    --------------

    @blank int

    @SA int

    @FAX int

    @<A href="mailto@NI">@NI int

    @BkOPC int

    @Up int

    @EPCOPC int

    @NwHk int

    @NEWOPC int

    @DW int

    @NR int

    @art int

    @new int

    @Total int

    Modifications:

    --------------

    02/02/2004 Created

     

    --------------------------------------------------------------------------

    --------------------------------------------------------------------------

    */

    --Declarations:

    ---------------

    Declare @blank int

    Declare @SA int

    Declare @FAX int

    Declare @NI int

    Declare @BkOPC int

    Declare @Up int

    Declare @EPCOPC int

    Declare @NwHk int

    Declare @NEWOPC int

    Declare @DW int

    Declare @NR int

    Declare @art int

    Declare @new int

    Declare @Total int

    --Counts each Disposition

    Select @blank = (Select Count(*) from dbo.vw_AZ_Leads_Dialable where Last_Disp = ' ' )

    Select @SA = (Select Count(*) from dbo.vw_AZ_Leads_Dialable where Last_Disp = 'SA' )

    Select @FAX = (Select Count(*) from dbo.vw_AZ_Leads_Dialable where Last_Disp = 'FAX')

    Select @NI = (Select Count(*) from dbo.vw_AZ_Leads_Dialable where Last_Disp = 'NI')

    Select @BkOPC = (Select Count(*) from dbo.vw_AZ_Leads_Dialable where Last_Disp = 'BkOPC')

    Select @Up = (Select Count(*) from dbo.vw_AZ_Leads_Dialable where Last_Disp = 'UP')

    Select @EPCOPC = (Select Count(*) from dbo.vw_AZ_Leads_Dialable where Last_Disp = 'EPCOPC')

    Select @NwHk  = (Select Count(*) from dbo.vw_AZ_Leads_Dialable where Last_Disp = 'NwHk')

    Select @NEWOPC = (Select Count(*) from dbo.vw_AZ_Leads_Dialable where Last_Disp = 'NEWOPC')

    Select @DW = (Select Count(*) from dbo.vw_AZ_Leads_Dialable where Last_Disp = 'DW')

    Select @NR = (Select Count(*) from dbo.vw_AZ_Leads_Dialable where Last_Disp = 'NR')

    Select @art = (Select Count(*) from dbo.vw_AZ_Leads_Dialable where Last_Disp = 'ART')

    Select @new = (Select Count(*) from dbo.vw_AZ_Leads_Dialable where Last_Disp = 'NEW')

    Select @Total = (Select Count(*) from dbo.vw_AZ_Leads_Dialable)

    --Inserts new record into DBOLog_Dialable_AZ

    insert into DBOLog_Dialable_AZ

     (entrydt,Blank,SA,FAX,NI,BkOPC,Up,EPCOPC,NwHk,NEWOPC,DW,NR,ART,NEW,Total)

    Select

     Getdate(),@Blank,@SA,@FAX,@NI,@BkOPC,@Up,@EPCOPC,@NwHk,@NEWOPC,@DW,@NR,@ART,@NEW,@Total

     

  • you can just populate a log table with select Last_Disp , Kount=count(*) ,en_date=getdate() from dbo.vw_AZ_Leads_Dialable group by Last_Disp also its more general ,and works even if you add more Last_Disp types ,regards john ,nb sorry I was bit bussy but you are really good programmer

  • Thanks for your help. That works really good

Viewing 8 posts - 1 through 7 (of 7 total)

You must be logged in to reply to this topic. Login to reply