Import Export wizard in SQL Server step by step


After long time I have decided to write an article again. Hopefully they will be useful for you. Today I want to write about one of a very useful feature in SQL Server which is Import/Export. This functionality is very useful when you have any kind of structured data and you need to push it to your SQL server databases or on any situation that you need to share your data from SQL Server databases with specific format to others. The SQL Server Import Export wizard is based on SQL Server Integration Service (SSIS) but it is very simple and you do not need to have any experience with SSIS to use it. In below I am going to share how you can use SQL Server Import Export via SQL Server Management Studio.

Import Wizard: For this case we are going to push ImportSample.csv file to our CodingTips_DB database. This database has “tbl_ImportExport” table for this purpose.

If you need any help to create database or table you can find useful information in previous articles. Create Database  Create Table

Step 1: First of all you must connect to database server and select database.


Step 2: Right click on the database and select Import option under Tasks.


Step 3: Click Next button on the first page.


Step 4: Choose a Data Source page is provides variety of different data sources which can be selected to import data from SQL Server, Microsoft Excel, Flat File and etc. Based on data or file that you want to import to your database you can choose one of the available data sources from the list. For our scenario we must select Flat File Source from drop-down list box as shows in below picture because we have a csv file to import to our database. You can use Brows button to find your file. After that all columns are available in Columns tab to check. In Advanced tab you can change length of columns or data type and etc. Preview tab contains sample of data to check.

Column name in the first data row option must checked if your file has column name in first row.

Text qualifier text box must be populated by relevant character if the data in file a rounded by specific character like double or single quotes.

Step 5: Choose a Destination page provides variety of destination same as source. In our scenario we choose “Microsoft OLE DB Provider for SQL Server” and enter necessary information to connect to our database server. After that select the database from drop-down list.


Step 6: In this step destination table must be selected otherwise the new table will be created by wizard based on the information provided by you and source file data attributes. Edit Mappings window provides some more information and options to make sure mappings, data types and length of columns are correct. Furthermore you are able to select more options in this page to control your destination tables behavior.

Step 7: In Review Data Type Mapping page you can control the wizard behavior in case of any error. You are able to fail execution in case of error or truncation. All below warnings are related to type mismatch in our scenario, If wizard will not convert them automatically or you could not fix them by changing data types in previous step you must save the wizard as a SSIS package in next step and manipulate the package via data tool.


Step 8: In this page you can run your wizard immediately or save it as SSIS package and manipulate it in data tool.


Step 9: Finally, you can get the execution report in this page.



What is connect module and how it works in Node.js

Hey guys,

I hope you are good, I am fantastic today 🙂  I got my first mechanical keyboard, I feel awesome about it 🙂

Today I have very interesting topic for you. I will show you how to work with connect module and how to process response and request. I hope you enjoy it 🙂




What is Nitrous and How can code on browser?

Hey guys,

I just uploaded a video on my channel, I tired to explained about one of the coolest cloud service that I have seen, it helps you to code on PHP,Node.Js and so many other languages just on your browser without installing any extra tools or application on your machine.

enjoy the video.

Create and Read Excel File in C#

Hello guys 🙂

It is very common for applications to have import or export in excel format. There are plenty options that you can use to read or write an excel file in .net. Today I am going to introduce you two simple libraries that are open source and can help you in reading and writing excel files in any type of .net applications.


Here is a simple code that create an excel file by using EPPluslibrary, you can download the full source code directly from my git-hub

Before you start coding you need to make sure that you have imported these libraries :


using Excel;
using OfficeOpenXml;
using System;
using System.Collections.Generic;
using System.Data;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

Creating Excel:

public string CreateExcelFile(DirectoryInfo outputDir)

FileInfo newFile = new FileInfo(outputDir.FullName + @"\sample1.xlsx");
if (newFile.Exists)
newFile.Delete();  // ensures we create a new workbook
newFile = new FileInfo(outputDir.FullName + @"\sample1.xlsx");
using (ExcelPackage package = new ExcelPackage(newFile))
// add a new worksheet to the empty workbook

ExcelWorksheet worksheet = package.Workbook.Worksheets.Add("Student Lists");
//Here  column to  the current sheet
worksheet.Cells[1, 1].Value = "Title";
worksheet.Cells[1, 2].Value = "Name";
worksheet.Cells[1, 3].Value = "Family";
worksheet.Cells[1, 4].Value = "Student Code";

//Add value to celles

worksheet.Cells[2, 1].Value = "Mr.";
worksheet.Cells[2, 2].Value = "Mehran";
worksheet.Cells[2, 3].Value = "Janfeshan";
worksheet.Cells[2, 4].Value = "ST54516";

worksheet.Cells.AutoFitColumns(0);  //Autofit columns for all cells
worksheet.HeaderFooter.OddFooter.RightAlignedText =
string.Format("Page {0} of {1}", ExcelHeaderFooter.PageNumber, ExcelHeaderFooter.NumberOfPages);
// add the sheet name to the footer
worksheet.HeaderFooter.OddFooter.CenteredText = ExcelHeaderFooter.SheetName;
//Save and export excel file



return newFile.FullName;

Reading Excel :

public DataSet ReadExcel()
string filePath;
filePath = "C:\\sample1.xlsx";
FileStream stream = File.Open(filePath, FileMode.Open, FileAccess.Read);
IExcelDataReader excelReader = ExcelReaderFactory.CreateOpenXmlReader(stream);
excelReader.IsFirstRowAsColumnNames = true;
DataSet result = excelReader.AsDataSet();
return result;

Please contact me if you have any issue with the code.

How can create Module in Node.js and reference them in any js file?

Hey guys,

Node.js same as other programming languages supports module. Basically modules help us to have better structure for our application and also it let you to maintain your application easily. For example you have an application that are doing these tasks:

1. Send email
2. Grab files from FTP
3. Create output files and upload into FTP
Each of these tasks can be a separate module, for those that are familiar with object oriented programing, module can play the same role as class. Module is not something new in Node.js but you must know how to define module and how import them to your app.js or anywhere that you want to use them.
Follow these few steps:
1. Create a js file in root folder. ( you need to have node folder, if you do not know what is node folder you can first look at this post)
2. Each module can have two types of function.
2.1. Public function which others can call this function and it is like interface for the module.
2.2. Private function which is used by other functions inside the module and others from outside cannot use it.
3. Copy can past these code inside the js file.

var name;

exports.getname = function(inputname){


exports.Printname = function(){


This is a very simple example of module, in this module we have a global variable which is name and two functions, first is getname which gets name and the other one is Printname which prints out the name. To make a function public we need to export it.

How can call a module?
It is very easy, first you need to import your module, in this example I want to import the module in app.js file but it can be imported in any other js file, based on your need. To impost any module you must use this command:

var testmodule = require("./getname.js");

require is something like import in or using in C#, if your module installed inside the node_modules folder, then you do not need to mention any path an straight you can name the module. But if your js is in the root then you can access to it thru this address:

(“./getname.js”) // Name can be anything based on your module name

“Require” creates an object from the module, so after that you can access all exported function via that object:


I hope this example helps you to understand Node module better, Node.js is like a puzzle you need to spend time to understand the whole story, and it may not be easy as the environment and concept is a bit different with what we used to it.

you can download full set of code form my github :

for any questions you can contact me through my email :

bye bye

What is Git and why should I use Git?

Hey Guys

I believe, If Microsoft starts working on something or if it buys a start-up company you must take it serious. We all know that Microsoft left behind in so many things same as Mobile, tablet and even Cloud that’s why it is trying to buy new companies or include new technologies inside its product . Any way I want to talk about Git as Microsoft supports it.

Let see what Git is:

I am sure most of you heard about source control if even you have not used it yet. Source control is not a new term in developing and programing world. Developers always were looking for a tool that can help them to keep track of the changes on the code and help them to control the version of application.  Demands for source control became more and more as IT industry expanded its own in every angle of our life. And development companies needed source control to let different member of a team work in one project at same time to develop it faster. Microsoft came with Source Safe and then upgrade it to TFS (team foundation server) and of course other companies came with other source control same as PVSC, Vault, and Perforce and etc.  I can say all of these products were awesome and still TFS is one the first choice for most of Microsoft based developer. But as a developer we always must look around for better options. One of the best option is Git. Git is an open source, source control which is developed by founder of Linux (Linus Torvalds) at that time he wanted to have a source control with special features for linux development team, finally he found out that there is no such product in the market so he decided to build his own source control and finally he came with Git, if you want to read more about the history of Git you can find it here.

Basically there are two types of source code control

  1. Centralized source control same TFS and source Safe.
  2. Distributed source control same Git.

In centralized source control live connection to the server is mandatory for any check in and check out and all clients must get the latest version from centralized repository. But on the other hand in distributed source control, each client has all source code plus all the histories of source code, and also each client has own repository, but it does not mean that there is no centralized repository.

I should say that the logic behind centralized and distributed is totally different, that’ why when someone like me wants to move from TFS to Git, he may feel uncomfortable and I am sure you may tell yourself that TFS is much more better. I should say that this kind of feeling when you are moving from current source control to Git is very normal. But once you understood the concept of Git, you can see that Git is much more better than your current source control and it will give you much freedom and features that you cannot have it in an application same as TFS. First I wanted to record a video and show you how to use TFS but later I found a very good recorded video and I decided to post the link here, I suggest you before start any search about Git, watch this video. It can help you a lot and you may not need any other tutorial.

Video Link :

If you have any question you can leave a comment here or always you can contact me via email:

bye bye

How can connect to the MongoDB through Node.js?

Hey guys,
Today I am going to show you how connect to MongoDB through Node.js. Please follow the below steps:
Note: for those that do not know how to install and use MongoDB please what this Video or ready this post
Note: I am using Webstorm to develop Node.js, you can install 30 days trail version and if you found it is good then buy it or you can use Code IDE which is an IDE that is provided by Microsoft and it is free 
If you use Webstorm, it creates everything for you and you only need to change the code and no need to be worry about the packages and other settings that normally needed for Node.js, here is my Webstorm screen:

There are different libraries that can help you to connect to MongoDB, for this tutorial I am using monk, which is simple and very light.
1. Add these few lines of code to app.js file :

var mong = require('mongodb'); // we import MongoDB
// library to our project
var monk = require('monk');// we create an object 
//from monk liberay in order to connect to MongoDb
var db = monk('localhost:27017/userlist');// we create an database 
//object which is connected to our ruing MongoDB instance

2. In the next step we need to set db in all requests that come to our server, it is a bit different with what we have done in you must be aware that concept in Nodde.js is very different with what you know in or even Java.

req.db = db;

3. This few lines of code must be add before:

app.use('/', routes);
app.use('/users', users);

4. After these two simple steps, our app.js is ready to connect to MongoDB and gave service to rest of application. Now we need to add two functions to our route and create two more views in order to show the result and get data from user. Direct go to the route folder and open index.js and add these two functions:

Get data:

var db= req.db;
var collection=db.get('testcollection');





Receive post request and insert in database.'/adduser', function(req, res) {

// Set our internal DB variable
var db = req.db;

// Get our form values. These rely on the "name" attributes
var userName = req.body.username;
var userEmail = req.body.useremail;

// Set our collection
var collection = db.get('testcollection');

// Submit to the DB
"name" : userName,
"email" : userEmail
}, function (err, doc) {
if (err) {
// If it failed, return error
res.send("There was a problem adding the information to the database.");
else {
// And forward to success page

We need two different views for these two functions, To add view, straight go to the view folder, copy and paste index.jade and change name to userlist ‘and do the same and name it adduser.

Open userlist and copy this code there:

extends layout

block content
User List
each user, i in userlist

Open adduser and copy this code there:

extends layout
block content
h1= title
input#inputUserName(type="text", placeholder="username", name="username")
input#inputUserEmail(type="text", placeholder="useremail", name="useremail")
button#btnSubmit(type="submit") submit

I tried to explain everything in a short way. I will try to upload and video to show you everything.

Run your project and go to these two address to see your result:



Bye bye