Archive for April, 2010

Windows Authentication in SQL Server 2005

Few days earlier, I came to learn some very basic login stuffs while working on Windows Authentication Mode of SQL Server. My task was to disable the Windows Authentication Mode. This is really very simple but it may irritate you if you are not informed of following facts.

First of all, you can’t disable or drop [BUILTIN/Administrators] or [ComputerName/UserName] Windows Credentials if you are logged in to SQL Server using this account.
Continue reading


APPLY Table Operator in SQL Server 2005

APPLY Table Operator is available in SQL Server 2005 and later editions. This evaluates the right hand-side table expression to left hand-side table expression. Other way, it correlates each row of left-hand side table expression to right hand-side table expression.

Let’s try to make it clear by coding. You can use NorthWind, AdventureWorks or download the database here to run those scripts.
Continue reading

How to Export Data to or Import Data from Excel in SQL Server 2005

It’s possible to export data to Excel and import data from Excel using T-SQL Command in SQL Server 2005.

First of all, you need to enable ‘Ad Hoc Distributed Queries’ in SQL Server 2005. Prior to this you may have to enable ‘show advanced options’, if it requires.

Create an Excel file and create columns like the Table’s columns that you are going to export data from.
Continue reading

BULK INSERT T-SQL Command to Import Data from Text or CSV File in SQL Server 2005

BULK INSERT T-SQL Command in SQL Server allows users to import data directly from CSV or Text file in to SQL Server 2005 right from Query Window. First of all, let’s have a quick look at syntax of BULK INSERT.

Continue reading

SELECT INTO – Copy Only Table Structure, Table with Data, Data in SQL Server 2005

SELECT INTO SQL Command allows to copy Table Structure, Rows from an existing Table. If you are not familiar with this Command yet, go through the post. It will give you a good introduction to SELECT INTO Command in SQL Server.

Continue reading

ComboBox with DataGridView in C#

Using ComboBox with DataGridView is not that complex anymore but it’s almost mandatory while doing some data driven software development.

I have created a DataGridView like this one. Now, I want to show “Month” and “Item” instead of “MonthID” and “ItemID” in DataGridView.
Continue reading

Insert, Update, Delete with DataGridView Control in C# (Windows Application)

DataGridView control is one of the coolest features of Dot Net Framework. You can use this control in Windows Form using Wizard or programmatically.

Add a DataGridView control and two Buttons on a Form. One Button is for deleting the selected row and other one is for updating or inserting new row.

Declare those variables as shown below.
Continue reading