Tuesday, January 07, 2014

How to: Set default database in SQL Server

Happy New Year to you all, Its been while I have stopped blogging. To get started back to blogging I have started with this small tip which saves your time. After all time is what we don’t have these days.

In SSMS whenever we connect to any database server by default the master database. Which forces us in changing the database to the one we want work using the USE statement or by using mouse and changing the selected db from the drop-down list. So this we will be doing this all-day and wasting time by doing this multiple times.

As a developer by default we mostly connect to single database at times specific to our project. So SQL Server Management Studio (SSMS) provides a way to change this. And next time onwards this new selected database will selected by default instead of the MASTER DB.

Here are the Steps:

  1. Open SQL Server Management Studio
  2. Select the instance you want to configure and connect to it by using your preferred authentication
  3. Go to object Explorer -> Security –> Logins
  4. Right click on the login and select properties
  5. And in the properties window change the default database to the one you want to select and click OK.

defaultdb

Alternatively, we can change this by below simple statement as well:

-- @loginame --login name is the you use for SQL authentication
-- @defdb -- name of the default database
Exec sp_defaultdb @loginame='sa', @defdb='Test'

Sunday, October 27, 2013

Microsoft : Junk Email Filter for Outlook

I found a plug from Microsoft outlook which reduces these emails. This is a free plug-in available for users of Microsoft Outlook 2007, 2010 and 2013 which you can download from here.

After installing it, and restarting Outlook, you will be able to report Junk by right-clicking the email and selecting Junk à Report Junk

The software will do the rest for you.

Hope this helps!!

Thursday, October 24, 2013

How to hide Validation Summary from JavaScript in .NET?

Here is how you can hide validation summary using the below JavaScript.  Call this in your aspx page. This should do trick for you.

function HideValidationSummary(){

if (typeof(Page_ValidationSummaries)!= "undefined"){ //hide the validation summaries
for (sums = 0; sums < Page_ValidationSummaries.length; sums++) {
summary = Page_ValidationSummaries[sums];
summary.style.display = "none";
}
}

}

It works in IE and Mozilla. Hope this helps

 

Tuesday, October 08, 2013

iPad microphone not working with Skype

Recently I ran into this issue as all of a sudden my Skype microphone stopped working. I tried to re install it and that doesn’t work for me. Later I realized that I have recently updated my iPad to iOS 7 which could cause some privacy settings.

So I looked into settings and found that my micro phone setting for Skype were blocked. Here is how we can un block it again

Go to Settings > Privacy > Microphone > Skype

Hope this helps for users like me..

Friday, September 27, 2013

SQL: Data Types

Data Type Syntax Explanation (if applicable)
integer integer
smallint smallint
numeric numeric(p,s) Where p is a precision value; s is a scale value. For example, numeric(6,2) is a number that has 4 digits before the decimal and 2 digits after the decimal.
decimal decimal(p,s) Where p is a precision value; s is a scale value.
real real Single-precision floating point number
double precision double precision Double-precision floating point number
float float(p) Where p is a precision value.
character char(x) Where x is the number of characters to store. This data type is space padded to fill the number of characters specified.
character varying varchar2(x) Where x is the number of characters to store. This data type does NOT space pad.
bit bit(x) Where x is the number of bits to store.
bit varying bit varying(x) Where x is the number of bits to store. The length can vary up to x.
date date Stores year, month, and day values.
time time Stores the hour, minute, and second values.
timestamp timestamp Stores year, month, day, hour, minute, and second values.
time with time zone time with time zone Exactly the same as time, but also stores an offset from UTC of the time specified.
timestamp with time zone timestamp with time zone Exactly the same as timestamp, but also stores an offset from UTC of the time specified.
year-month interval Contains a year value, a month value, or both.
day-time interval Contains a day value, an hour value, a minute value, and/or a second value.