Ashok Basnet

Engineer | Entrepreneur | Programmer | Blogger | CEO / Co-founder [Mantra Ideas Pvt. Ltd.]

Category

SQL Server

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. SELECT SUBSTRING(convert(varchar(50),NEWID()),0,8) as password This generates 8… Continue Reading →

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; DECLARE @StudentID char(11); DECLARE crs CURSOR READ_ONLY FOR SELECT student_id FROM students… Continue Reading →

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… Continue Reading →

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’… Continue Reading →

© 2017 Ashok Basnet

Powered by WordPressUp ↑