Thursday, September 10, 2009

ACTIVE CONNECTIONS FOR EACH DATABASE IN SQL SERVER 2005

The script displays the DatabaseName, the number of connections and the login name :

SELECT db_name(dbid) as DatabaseName, count(dbid) as NoOfConnections,
loginame as LoginName
FROM sys.sysprocesses
WHERE dbid > 0
GROUP BY dbid, loginame

visit for more http://www.sqldb.in
REJOIN BE A SMART SQLDBA

$1.99 Web Hosting

SERVICES I CAN PROVIDE :: PANKAJDEV73@GMAIL.COM



NEEDS ASSESSMENTS & INFORMATION SYSTEMS DESIGN
I can conduct needs assessments in the form of preliminary scans of top level, high urgency organizational issues and/or conduct in-depth assessments based on your organizations specific concerns.

Based on a needs assessment, I can help you to:

justify project or program costs
identify organizational processes which need improvement
prioritize issues for future action
implement solutions for your organization’s information systems
recommend solutions that will meet your needs, based on your existing computers, processes and users
CUSTOMIZED RESEARCH
Nonprofits should keep up with research in the areas that are most important to them. For example, human services should follow the literature on effective service models relevant to their mission, and fund raisers should track consumer and marketing research. Most nonprofits don’t have the expertise to do quick, focused and useful research on key issues.

My research specializes in program development and the state of the art in human services.

PROJECT MANAGEMENT & PROCESS IMPROVEMENT SERVICES
If you wish to undertake a process improvement effort or if your organization is attempting to develop procedures and guidelines for managing projects, I can assist you.

SYSTEMS ANALYSIS AND DESIGN
Interviews with key users
Development of plans and schedules
Development of procedures
Database design and development
Determination of hardware and software requirements
BUILDING PROJECT MANAGEMENT COMPETENCE IN ORGANIZATIONS
Consultation regarding program management and process
Process audits and consultation on process improvement
Development of functional requirements, project plans and verification plans
Research on vendor selection based on organizational needs
Development of RFPs and vendor selection processes
Oversight and supervision of outsourced project teams to ensure that project is on track
Training and consultation to staff regarding software development processes.

TABLE FROM A .CSV OR .TXT

You can use Bulk Insert or SSIS to import text/csv files. There are some advantages and disadvantages using any of these methods. In this article, we will explore how to use the OPENROWSET to read a data file and populate a table.

Note: In SQL Server 2005, OPENROWSET can read from a data file without loading the data into a target table. This lets you use OPENROWSET with a simple SELECT statement.

Follow these steps:

Step 1: Create a database called ‘Employees’. Create a table called ‘
EmployeeDetails’ in it using the script given below:

USE [Employee]
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO

CREATE TABLE [dbo].[EmployeeDetails](
[EmployeeID] [nvarchar](50) NOT NULL,
[EmployeeName] [varchar](50) NULL,
[EmployeeAddress] [varchar](50) NULL
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF

Step 2: To run ad-hoc queries on the SQL server, you would first need to enable it using the following query:

sp_configure ’show advanced options’,1
RECONFIGURE WITH override
GO
sp_configure ‘Ad Hoc Distributed Queries’,1
RECONFIGURE WITH override
GO

Step 3: Create a txt/csv file with the following format on your C:\. The file is called ‘Employee.csv’

EmployeeID EmployeeName EmployeeAddress
1 TAM 50/Central. Park
2 SAM Banga Street
3 RAM Clifer Road

Step 4: The final step is to run the query and populate the EmployeeDetails table

USE Employee
GO
INSERT INTO EmployeeDetails(EmployeeID,EmployeeName,EmployeeAddress)
SELECT *
FROM
OPENROWSET(’MSDASQL’, ‘Driver={Microsoft Text Driver (*.txt; *.csv)};
DEFAULTDIR=C:\;Extensions=CSV;’,'SELECT * FROM Employee.csv’)

http://www.sqldb.in

Blossom Yourself with http://www.blossomtimes.org