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

A Simple Trick to Combined Multiple .SQL files into One Single File

Do the following task to combine all the *.sql files into one sql file

Files within the folder:

type *.sql > OneFile.sql

Multiple Files in Multiple Folder:


type e:\Folder1\*.sql e:\Folder1\Folder2\*.sql > e:\Folder1\final.sql

March 25, 2015

Find All Servers From Local Network and Installed SQL Server on Network

To create list of all the SQL Server on local network and SQL Server installed on the other systems around the network.

Go to command prompt and type in “osql -L” or “sqlcmd -L”.

Result:
shyamb4u








If you have a large number of SQL servers in your network, you can push the results of SQLCMD -L to an output file as DOS doesn’t allow you to scroll-up past a certain point. To do this you would simply type at the command prompt:
sqlcmd -L > D:\servers_filename.txt

February 27, 2015

To find status of your DB in your SQL Server.

A simple script that is enable me to save lot of time, to find out which database is in runnable status in my server. you can use SQL Profiler but i find this one is very simple for me.hope it helps you friends!!!!

EXEC sp_who

February 23, 2015

Difference b/w Normal / NoCompressed Backup Files in SQL

An SQL Query that gives me 3-4 times better performance and less size than Normal / NoCompressed Backup

Compressed Backup


BACKUP DATABASE MyDatabase TO DISK='E:\MyDatabaseCompression.BAK' WITH COMPRESSION ,INIT

--BACKUP DATABASE successfully processed 172926 pages in 40.806 seconds (34.715 MB/sec).

Not Compressed Backup

BACKUP DATABASE MyDatabase TO DISK='E:\MyDatabaseNoCompression.BAK' 


--BACKUP DATABASE successfully processed 172926 pages in 111.007 seconds (12.761 MB/sec). 

See the time taken; its almost 1/3 of NoCompression Backup. The size of the backup files Compressed is 197 MB and Uncompressed is 1386 MB.


Finding if Current Week is Odd or Even – Script

To Finding if Current Week is Odd or Even – Script

DECLARE @CurDate DATETIME
SET @CurDate = GETDATE()
SELECT
WeekOfMonth = DATEPART(wk, @CurDate)
- DATEPART(wk,DATEADD(m, DATEDIFF(M, 0, @CurDate), 0)) + 1,
CASE WHEN (DATEPART(wk, @CurDate)
- DATEPART(wk,DATEADD(m, DATEDIFF(M, 0, @CurDate), 0)) + 1) % 2 = 1
THEN 'Odd' ELSE 'Even' END EvenorOdd

February 11, 2015

How to Disable and Enable All Constraint for Table / Database

To enable or disable all the constraint for single table or database.


-- Disable all table constraints
ALTER TABLE YourTableName NOCHECK CONSTRAINT ALL
-- Enable all table constraints
ALTER TABLE YourTableName CHECK CONSTRAINT ALL
-- Disable single constraint
ALTER TABLE YourTableName NOCHECK CONSTRAINT YourConstraint
-- Enable single constraint
ALTER TABLE YourTableName CHECK CONSTRAINT YourConstraint
-- Disable all constraints for database
EXEC sp_msforeachtable "ALTER TABLE ? NOCHECK CONSTRAINT all"
-- Enable all constraints for database
EXEC sp_msforeachtable "ALTER TABLE ? WITH CHECK CHECK CONSTRAINT all"