My blog has moved!

You will be automatically redirected to the new address. If that does not occur, visit
http://ashokbasnet.com.np
and update your bookmarks.

Thursday, June 28, 2012

Randomly generate password in SQL Server 2008

There are lots of ways of generating random strings in SQL Server. But instead of spending much time on finding solution to random password generation, here is an easy way to do that.

Using Cursor to iterate through records in sql server 2008

Cursors are great way to loop through records in SQL specialy when you need to deal with individual records from certain table.

Here is a example using cursor;

Tuesday, June 26, 2012

Conversion of Imperial to Metric System in SQL Server 2008

There will be case when you need to convert the values in Imperial system i.e. in feet and inches to the one in metric system. The conversion logic seems simple, but when it comes to SQL Server, it takes a bit complex.

Here is the function which can convert imperial unit of measurement to the metric system.

Reset indentity value of Auto increment Key to 0 in SQL server 2008

I have been searching for resetting the Auto increment value of ID Column in MSSQL Server 2008 and finally solved the problem. You can simply do the following in SQL.

The following line resets the Identity value for the ‘MyTable’ table to 0 so that the next record added starts at