Tuesday, February 24, 2015

How do you create a database in SQL Server using Power Shell?

Review this previous post    http://hodentekmsss.blogspot.com/2014/11/accessing-sql-server-via-smo-using.html

In the above post you will get an introduction to Power Shell and SQL Server maangement Objects. You also learn how to access the SQL Server and carry out a few tasks like listing out all the databases.

In this post you will learn how to create a new database in SQL Server using SMO and Power Shell. Using Transact-SQL or the SSMS you can easily create a database. Using PowerShell is another option to create a database using a script.

Launch Power Shell by right clicking the instnace node as shown.


This ensures that you have access to the SQLServer's SMO library.

You will be launching the shell with the following line:

Enter the following code one line at a time. After you enter the line and click enter you may not get any message. Continue with the other lines.

$server= new-object Microsoft.Sqlserver.management.smo.server 'Hodentek8\RegencyPark'
$dbname= "Feb6"
$db=new-object  Microsoft.Sqlserver.management.smo.Database ($server,$dbname)

When the final command line is processed you will have created a new database Feb6 in your SQL Server Instance as shown. It will have default settings.


How can I connect to an Microsoft EXCEL file on my Windows 8.1 laptop?

If you have Office running on your laptop it should be immediately possible and you would not be asking this question. Although you do not have Office sometimes you may want to connect to it.
For example you may use a Export/Import wizard to create a Excel file from the data on your SQL server. In such cases you come up with the following error:


You will find that there are no ODBC (x64) drivers on your machine which will enable to correct this error and you need to download and register them on your computer. Open ODBC Manager on your computer and verify.

Internet search reveals that you can download the Access driver (Microsoft Access Database Engine 2010 Redistributable) from here:


The details of this driver are shown here from the Microsoft site. This installation will provide drivers for office applicaitions including MS ACCESS and MS EXCEL.

Download and install the AccessDatabaseEngine_x64.exe file and double click the file to run the program.
Excel 22

This will install the Microsoft EXCEL and Microsoft ACCESS drivers needed for connectivity.


Thursday, January 29, 2015

How popular is JavaScript?

It has gained lot of popularity because of the many libraries developed succh as jQuery, Bootstrap, Node.JS, win.JS, dogo etc. Toagether with HTML5 it has become all the more popular for web development.

The popularity of a programming language is described by an inex called the TIOBE Index.
TIOBE index provides a measure for the popularity of programming languages as mined from search engines. It includes many browser results as well as many programming languages. The index is published every month and for the month of January you can find it here:

Programming languages C and Java are the top dogs and Javascript jumped from 9 to 7 in January 2015 and C# steady from 2014 to 2015 at 5.

TIOBE Index is calculated by the query +"Language> programming" to the search engines.

Get more info on TIOBE herre:


Tuesday, January 27, 2015

Where do I find the C# Compiler on my computer?

The C# compiler CSC.exe is found here:

This is on a Windows 8.1 Professional machine.

In any case search in this folder by changing the directory as shown below
C:/ cd %Windir%/Microsoft.NET/Framework

You may find more than one Framework on your computer
The one shown in the beginning of this post is for version 4.0.30319

Monday, January 26, 2015

Can I work on Stored Procedures using LinqPad?

Of course you can. In version4.51.03 you can easily run stored procedures you have created using both SQL and C# Expression.

For example, after connecting to AdvventureWorks2012 database I can see all the stored procedures. Right clicking a stored procedure and choosing StoredProceedureName(...) drop-down, you display the stored procedure in the query window. You need to insert the parameters inside the parenthesis containing the ellipsis and run the query.

Examples are shown in the following two posts:



Tuesday, December 30, 2014

2014 was a mixed year

2014 was a mixed year. I lost my brother Dr. Vijaya Raghavan Krishnaswamy, a neuro-surgeon by profession. He left a void that cannot be filled.

I did not complete the book I was writing.

Regarding the blogs I did quite well with a record number of posts.
                                                 Year   Posts
Hodentek.blogspot.com           2013   94
                                                 2014   246

HodentekHelp.blogspot.com.  2013.  17
                                                 2014   56

HodentekMsss.blogspot.com   2013   34
                                                  2014  48
HoentekMobile.blogspot.com  2013   13

I started a new blog in 2014- http://hodentekPlus.blogspot.com.

I also found that a certain person was pilfering (http://hodentek.blogspot.in/2014/12/domain-name-service-dns-and-dns-changer.html) entire content from blog, my hardwork of about 10 years. I complained to Google without any success. I suppose this is not on Google's priority. Google wants every post that is stolen with proof of content stolen. There were over 900 posts in my blog and you can imagine the work involved.

Sunday, December 7, 2014

What is LINQ?

We know that a query is a question we pose to the database to retrieve some information that we would like to know. For example, in a database that consists of men and women, you may want to know how many men and how many women. Let us go a step further and say that there are people of all nationalities in the database of men and women. You may want to know how many women who hail from Europe are there. This is only filtering of the information but a query can much more complex. This is of course querying a database, let us say a relational database such as the SQL Server where you use the Structured Query Language(SQL), a special language you have to learn.

All data are not in relational databases and they could be in some kind of an XML document, a web service or something else. For example, in order to find some filtered content in an XML document you would use a language called XQuery which is not the same as SQL. This means there is need to learn another query language.

Beginning with Visual Studio 2008 and .NET Framework 3.5 Microsoft introduced LINQ which stands for Language-Integrated Query an innovation that made it possible to query a SQL Server database, an XML document, Web Services etc with a single lanugage and it is a first class query language.

In Visual Studio you can write LINQ in both VB and C# for any collection that supports IEnumerable or the generic IEnumerable interface (or to put it simply a collection in which one can go through the collection item by item).

For example you may have a list  of names ("John", "Tom", "June", "Diana") etc.  or  the number of rows in a database table , etc. and they can be queried using LINQ.

Need to query SQL Server with LinqPad, review the following posts: