February 22, 2016

MS SQL : Use of GUID function

If you want to generate a new Guid (Unique Identifier) in SQL server the you can simply use the NEWID() function.

Example

SELECT NEWID( )
GO
-- This will return a new random uniqueidentifier e.g.
E75B92A3-3299-4407-A913-C5CA196B3CAB

To select this Guid in in a variable

--To Assign uniqueidentifier in a variable
DECLARE @EmployeeID uniqueidentifier
SET @EmployeeID = NEWID( )

You can directly use this with INSERT statement to insert new row in table.

-- Inserting data in Employees table.
INSERT INTO Employees
(EmployeeID, Name, Phone)
VALUES
(NEWID( ), 'Shyam Sundar', '123-4567')

MS SQL : Function to Convert INR Value

Function (numberVar Amount)
numbervar RmVal:=0;
numbervar Amt:=0;
numbervar pAmt:=0;
stringvar InWords :="";
stringvar ckAmt:="";
Amt := ABS(Amount);
ckAmt := CSTR(ABS(Amount));

MS SQL Server Recovery Models

One of the first things that needs to be set in order to create the correct backups is to set the proper recovery model for each database.  The recovery model basically tells SQL Server what data to keep in the transaction log file and for how long.  
Based on the recovery model that is selected, this will also determine what types of backups you can perform and also what types of database restores can be performed.

The 3 types of recovery models that you can choose from are:

  • Full
  • Simple
  • Bulk-Logged


January 18, 2016

What are OLTP and OLAP , its difference?

OLTP vs OLAP

OLTP (On-line Transaction Processing) is characterized by a large number of short on-line transactions (INSERT, UPDATE, DELETE). The main emphasis for OLTP systems is put on very fast query processing, maintaining data integrity in multi-access environments and an effectiveness measured by number of transactions per second. In OLTP database there is detailed and current data, and schema used to store transactional databases is the entity model (usually 3NF).

OLAP (On-line Analytical Processing) is characterized by relatively low volume of transactions. Queries are often very complex and involve aggregations. For OLAP systems a response time is an effectiveness measure. OLAP applications are widely used by Data Mining techniques. In OLAP database there is aggregated, historical data, stored in multi-dimensional schemas (usually star schema).

July 24, 2015

Merging Contact Files .VCF Files In One File..

Telephone directory or Contacts are most important thing for everyone in this world and no one would like to loose information like phone numbers, addresses etc..
Generally if we want to import or transfer contacts from one gizmo to another or to create a backup of contacts, we use " VCARD " feature. In this feature, each contact is saved in a separate vCards(.vcf file) format. If you have too contact files (.vcf files) and you want to transfer them into some gizmo or any online account it becomes a hectic task. 
At this moment, converting or combining them into one single contact (.vcf) file is useful and handy, so instead of carrying thousands of contact files its better to carry one single file wherever you need. Merging of contact files can done easily and manually and within few minutes using COMMAND prompt.

1. If you're using windows: 

GOTO Command prompt. (Windows_Key + R) - Run: cmd

2. Change to the directory where all your VCFs are stored
            d: cd   \my_vcfs - Location of all ur .vcf files

3. Run this command
           copy   /B   *.vcf   all_in_one.vcf

May 23, 2015

How to Check Database Integrity in SQL

Check Database Integrity for All Databases of Server

-- Single Database -- Use (?) for all the Database.

EXEC sp_msforeachdb 'DBCC CHECKDB(''DB_Name'')'

-- SQL 2005

EXEC sp_MSforeachDB 'DBCC CHECKDB (?) WITH ALL_ERRORMSGS, DATA_PURITY'

-- SQL 2008 and later

EXEC sp_MSforeachDB 'DBCC CHECKDB (?) WITH ALL_ERRORMSGS, EXTENDED_LOGICAL_CHECKS, DATA_PURITY'

Types of Testing Phases - DIT - SIT & UAT

Abbreviations of testing phases

DIT means - Development Independent Testing
SIT means - System Independent/Integration Testing
UAT means - User Acceptance Testing