How to import data from Excel file to SQL Server:

In this post, we would see how to import data from Excel file to SQL Server using Import and Export Wizard, we would import data from four excel worksheets to SQL server. Here are the steps:

1) Right click the Target Database > Tasks > Import Data to open the SQL Server Import and export wizard

import data ssms sql server import export

2) select the Data Source. In this case, Excel file. You would select the worksheets to fetch data from later, for now – select the excel file as shown below:

import data ssms sql server import export

3) choose the Target Database:

choose the target database import and export systems

4) Select the tables (in our case- worksheets) or specify a query. For the purpose of this demo, we would go with “copy data from one or more table or views” option:

 specify table copy or query

5) Select the worksheets from the Excel file and also specify the tables in the target systems. If the tables in the target database are not already created, then would be created by this wizard:

sql server map source and targetsql server map source and target

6) You have the option of running this wizard immediately or you have the option of creating a SSIS package and then run it later. For the purpose of this post, we would select Run Immediately

7) Review the information and click Finish

sql server review the complete wizard

8) After successful execution:

8 sql server import export execution was successful

Conclusion:

In this blog post, we saw how to import data from Excel file to SQL server.

 

Back to basics: What’s CRUD?

Some year’s ago – I got introduced to SQL. At that time, I recall, I was sitting in a lab and one of the first exercises we did was to create a table in a database and adding data in it. In next lab, we ran SQL commands that updated records and deleted few. After we’re done – our instructor told us what we learned were the most basic programming functions i.e CRUD operations

CRUD stands for Create, Read, Update and Delete.

C: Create

R: Read

U: update

D: delete

Let’s see the SQL equivalent of CRUD operations:

Operation SQL
Create INSERT
Read SELECT
Update UPDATE
Delete DELETE

Is the concept of CRUD just applicable to SQL?

No. in fact, if you start learning programming or web development – one of the first things that you get to learn is how to run CRUD operations with that particular language.

Conclusion:

In this blog post, I documented four (4) basic programming functions i.e. Create, Read, Update and Delete.

Book Review: SQL server Interview Questions and Answers by Pinal Dave and Vinod Kumar.

Though SQL server is an huge ocean – this book does justice to touch-base on every different aspect of the product. Starting from the basic concepts and then discussing Tricky questions, authors Pinal Dave and Vinod Kumar lucidly explains each aspect in a Question Answer Format.

Personally, i liked the Tricky question section because it made me think about the topic at hand. And i believe, this exercise of thinking on my feet after reading the question will help me tackle questions during interviews that require quick thinking. And for questions which i knew, i learned the perfect way of answering them.

And every chapter, ends with a summary (called points to ponder) which is an excellent place to reflect upon and test one’s knowledge. And even if you are not planning to go for interview’s in near future – this book is a handy reference for all FAQ’s you may have on a day-to-day basis.

It’s an excellent book to master the SQL server Basics and Gain confidence before a SQL server based Interview. And perfect for any who is a SQL server Database Developer or a SQL server DBA or planning to be one!

 

Review cross-posted from: http://www.amazon.com/review/R2R7QM1NFVI8RE/ref=cm_cr_pr_perm?ie=UTF8&ASIN=1466405643&nodeID=&tag=&linkCode=

How to rename a SQL Azure database?

Can we rename a database in SQL Azure? Absolutely! In blog post, we will see how we can do that?

First, few things to note:

1. You need to connect to Master Database.

2. And you can rename only user databases. That means the master database cannot be renamed.

3. And the Alter database (which is the TSQL statement to rename database) should be the only statement in the batch.

Now, Here is the query:

 

alter database <old-database-name>

modify name =<new-database-name>

go
Here is the screenshot when I tried to rename the database name by login with the principal server login into the Master Database:

rename database SQL Azure

So that’s it – you can rename the database in SQL Azure.

Part 2 of “Getting started with SQL Azure” is live!

Aim of “Getting started with SQL Azure” series is to offer you a set of brief articles that could act as a Launchpad for your to-be wonderful journey of exploring Microsoft’s cloud based database solution i.e. SQL Azure.

In this blog post, i have discussed:

1) How to sign up for a Free trial of windows azure (to play with SQL Azure)!

2) How to create your very first SQL Azure database (and a table too!)

3) How to connect to SQL Azure server Via SQL server Management studio.

Read more: Getting started with SQL Azure – Part 2 << Paras Doshi

Migrating Data from SQL server to SQL Azure using BCP

BCP is an ideal straightforward command prompt driven tool to push data from one table to another similar table. This makes it an excellent tool to carry out data migration from SQL server to SQL Azure. And here is a blog post: Migrating SQL server Data to SQL Azure using BCP << Paras Doshi, i have written to show how we can migrate SQL server data to SQL Azure using BCP tool.

My article on “Tuning SQL Azure database – Part 1” got published in SolidQ Journal (July 2011) << Paras Doshi

My article on “Tuning SQL Azure database – part 1” got published in SolidQ journal July 2011 Issue. The editorial of the Journal written by Fernando G. Guerrero [Global CEO, SolidQ] summed up the article by following words: "Even if cloud computing hides some back-end complexity from us, databases still need to be properly designed and queries properly written. To this end, Paras Doshi explains how to tune SQL Azure databases".

LINKs:

Read : Tuning SQL Azure Database – Part 1 by Paras Doshi 

Download: Tuning SQL Azure Database – part 1 by Paras Doshi

Download: SolidQ Journal July 2011

step by step guide to use import and export features in the Microsoft SQL Server “Denali” Data-tier Application Framework v2.0 Feature Pack CTP to import and export data with SQL Azure

I have written a bog post on my SolidQ.com blog which discusses how to use DAC v2.0 to import and export data with SQL Azure. URL:  [ SQL Azure Labs ] Exploring SQL Azure Import/Export Feature (CTP)