13 Oct 2014

Code to Take -- RecId Count


Code To Get Rec Id Count:

Create a  Job :

static void Reccount(Args _args)
{
    ReadingEntryTmp  ReadingEntry;
    int  RecIdCount;
    ;
   
   
    Select count(RecId) from ReadingEntry where ReadingEntry.bookno== "1000";

    RecIdCount = ReadingEntry.RecId;

    info(strfmt( "Total recId %1", RecIdCount));
}

7 Oct 2014

Scheduling autobackup using SQL Server Agent

Scheduling autobackup using SQL Server Agent

Steps

Open sql server management studio from start menu or type ssms in run.
Expand management folder and right click maintenance plans folder and select maintenance plan wizard

  

 Click  ->next



give name for the plan and select single schedule radio button and click next




choose backup database(full) and click next



click next



In the following window choose the list of databases and click ok 



In the same window choose where the backup files will be stored (refer the highlighted screenshot below)
then click next.



In following window choose the location where the report file has to be stored and click next



click next 



if everything went fine you should see the following screen 



Now to schedule the job navigate to SQL server Agent expand jobs folder select the job that has the name same asmaintenance plan in our case its going to be TestDailybackup , right click the job and select properties



in properties window switch to schedule tab and click new button



In the schedule window choose a schedule according to your requirement (in my case i have scheduled the job to run daily at 5:30PM) then click ok



Note 
Before testing the job ensure SQL server agent service is running.if not start the service either from SQL server management studio or got to service.msc and start the service.


To test the job right click the job and select start job at step







 To view the backup go to the file path specified earlier (In my case its E:\ drive)