February 6, 2014

Get Client IP Address in SQL Server..

Execute the below function and call this function through a Stored Procedure. It will return the IP address of the client system.

CREATE FUNCTION [dbo].[GetCurrentIP] ()
RETURNS varchar(255)
AS
BEGIN
    DECLARE @IP_Address varchar(255);

    SELECT @IP_Address = client_net_address
    FROM sys.dm_exec_connections
    WHERE Session_id = @@SPID;

    Return @IP_Address;
END


Source

December 24, 2013

What is NAS, SAN, DAS ?

NAS stands for Network Attached Storage. It differs from traditional, directly attached storage in that, in NAS, the operating system and other software on the NAS product are dedicated solely to data storage.

SAN stands for Storage Area Network. A SAN is a network designed to attach storage hardware and software to servers. SANs generally come in two forms: as a network primarily dedicated to transferring data between computer systems and storage systems, or as a complete system that includes all of the storage elements and computer systems within the same network.

DAS stands for Directly Attached Storage. DAS is generally used to differentiate between storage systems directly attached to a server or workstation and NAS and SAN setups.


Source

December 12, 2013

How to fix orphaned SQL Server users?

The problem is that the user in the database is an "orphan". This means that there is no login id or password associated with the user. This is true even if there is a login id that matches the user, since there is a GUID (called a SID in Microsoft-speak) that has to match as well.

This used to be a pain to fix, but currently (SQL Server 2000, SP3) there is a stored procedure that does the heavy lifting.

All of these instructions should be done as a database admin, with the restored database selected.

First, make sure that this is the problem. This will lists the orphaned users:

EXEC sp_change_users_login 'Report'

If you already have a login id and password for this user, fix it by doing:

EXEC sp_change_users_login 'Auto_Fix', 'user'

If you want to create a new login id and password for this user, fix it by doing:

EXEC sp_change_users_login 'Auto_Fix', 'user', 'login', 'password'


Source : SQL BLOG

September 5, 2013

Create and Configure Virtual Directories in IIS 7.0

To create a virtual directory by using IIS Manager

1. In IIS Manager, expand the local computer and the Sites folder, and then find the Web site that you want to add a virtual directory for. Use the following steps:

o For , right-click the site or folder where you want to create the virtual directory, and then click Add Virtual Directory.

o For Windows Server 2008, right-click the site or folder where you want to create the virtual directory, click Manage Web Site, and then click Add Virtual Directory.

2. In the Add Virtual Directory dialog box, specify the following information:

o Alias. Type a name for the virtual directory. Choose a short name that is easy to type, because the user types this name to access the Web site.

o Physical Path. Type or browse to the physical directory that contains the virtual directory. You can select an existing folder or create a new one to contain the content for the virtual directory. 

3. To provide credentials to connect to a UNC path, click the Connect as button.

4. Click OK.

August 20, 2013

Difference between a Domain,Work group and Home Group?



In a work-group:

@ All computers are peers; no computer has control over another computer.
@ Each computer has a set of user accounts. To log on to any computer in the work group,you must have an account on that computer.
@ There are typically no more than twenty computers.
@ A workgroup is not protected by a password.
 @ All computers must be on the same local network or subnet.

August 14, 2013

SQL Aliases

SQL aliases are used to give a database table, or a column in a table, a temporary name.
Basically aliases are created to make column names more readable.

SQL Alias Syntax for Columns

SELECT column_name AS alias_name
FROM table_name;


SQL Alias Syntax for Tables

SELECT column_name(s)
FROM table_name AS alias_name;


Source: w3