When is the use of UPDATE_STATISTICS command?

This command is basically used when a large processing of data has occurred. If a large amount of
deletions any modification or Bulk Copy into the tables has occurred, it has to update the indexes to
take these changes into account. UPDATE_STATISTICS updates the indexes on these tables
accordingly.

Welcome to DotNetNuke

Welcome to the official community and development site for the DotNetNuke Open Source project. From downloads to documentation, DotNetNuke.com offers a comprehensive base of information, resources, and support to the DotNetNuke community.


DotNetNuke Is…

Versatile – DotNetNuke is an open source web application framework ideal for creating, deploying and managing interactive web, intranet and extranet sites.

User-Friendly – DotNetNuke is designed to make it easy for users to manage all aspects of their projects. Site wizards, help icons, and a well-researched user interface allow universal ease-of-operation.

Powerful – DotNetNuke can support multiple portals or sites off of one install. In dividing administrative options between host level and individual portal level, DotNetNuke allows administrators to manage any number of sites – each with their own look and identity – all off one hosting account.

Feature-Rich – DotNetNuke comes loaded with a set of built-in tools that provide powerful pieces of functionality. Site hosting, design, content, security, and membership options are easily managed and customized through these tools.

Supported - DotNetNuke is supported by its Core Team of developers and a dedicated international community. Through user groups, online forums, resource portals and a network of companies who specialize in DNN®, support is always close at hand.

Easily Installed – DotNetNuke can be up-and-running within minutes. One must simply download the software from DotNetNuke.com, and follow the installation instructions. In addition, many hosting companies offer free installation of the DotNetNuke application with their plans.

Localized – DotNetNuke includes a multi-language localization feature which allows administrators to easily translate their projects and portals into any language. And with an international group of hosts and developers working with DotNetNuke, familiar support is always close at hand.

Open Source – DotNetNuke is provided free, as open-source software, and licensed under a standard BSD agreement. It allows individuals to do whatever they wish with the application framework, both commercially and non-commercially, with the simple requirement of giving credit back to the DotNetNuke project community.

Cutting-Edge - DotNetNuke provides users with an opportunity to learn best-practice development skills -- module creation, module packaging, debugging methods, etc -- all while utilizing cutting-edge technologies like ASP.NET 2.0, Visual Web Developer (VWD), Visual Studio 2005 and SQL Server 2005 Express.

Extensible – DotNetNuke is able to create the most complex content management systems entirely with its built-in features, yet also allows administrators to work effectively with add-ons, third party assemblies, and custom tools. DNN modules and skins are easy to find, purchase, or build. Site customization and functionality are limitless.

Recognized – DotNetNuke is a trademarked name, and a brand widely recognized and respected in the open source community. With over 450,000 registered users and a talented team of developers, DotNetNuke continues to evolve its software through participation, real world trial, and end-user feedback.


DotNetNuke is designed for use on the Microsoft ASP.NET 2.0 platform. The most recently released version is 4.5.



More Info: http://www.dotnetnuke.com/


How do I get IntelliSense to see ASP 3.0 methods?

Methods like Server.Transfer and Server.Execute are not in Visual InterDev 6.0's IntelliSense (the little drop-down that completes methods and properties for you). Many people have asked why this is, especially when InterDev is installed on Windows 2000 with IIS 5.0 and ASP 3.0 installed.

I will try to explain what is going on, from my limited vantage point. IntelliSense itself gets its information from type libraries; in this case, it is a file with a .tlb extension. Since InterDev 6.0 does not detect which operating system / web server version it is being installed alongside, it ships with ASP 2.0's type library, not ASP 3.0's -- hence the currently missing method names.

So how do you get the new type library to be recognized by Visual InterDev? Is it even possible?


Yes, it is possible; observe the screen shot at left. It includes server.transfer and server.execute.

How did I do it? There are a few hoops to go through...

  1. Ensure that all Visual Studio components are closed.
  2. Go to \Microsoft Visual Studio\Common\IDE\IDE98\.
  3. Rename asp.tlb to asp.tlbak (just in case).
  4. Place this TLB file in that folder.


(Note also that Server.URLPathEncode, an undocumented method, has been removed from the new type library.)

The instructions for creating this TLB file are documented in KB #261101 -- but the methodology behind it requires OLEView and midl.exe to be installed and enabled on your machine. Also, if your machine isn't running ASP 3.0 (e.g. you develop on NT 4.0 and deploy to Windows 2000), you have to copy the new asp.dll to your local machine... I figured it would be easier to just give you the file. :-)

It seems that with the Visual Studio.NET Betas and Windows XP Professional (RTM Build 2600), you don't need to add this type library at all.

Of course, if you are afraid of messing up your system, do not alter your environment. This operation is not officially supported by Microsoft.

Remote IIS 5.x and IIS 6.0 Server Name Spoof

Remote IIS 5.x and IIS 6.0 Server Name Spoof

It is possible to remotely spoof the "SERVER_NAME" Microsoft® Internet Information Server® 5.0, 5.1 and 6.0 server variable by doing a modified HTTP request. Thus potentially revealing sensitive ASP code through the IIS 500-100.asp error page, the spoof also opens up a potential range of exploits in third party web applications and web services.

Technical Description
Microsoft® IIS 5.x ® shows sensitive information if the "SERVER_NAME" IIS 5.x server variable is "localhost". If a IIS 5.x ASP page has an error, the code on the fault line in the ASP page is shown in the browser, but only if"SERVER_NAME" IIS server variable is "localhost". One can spoof the "SERVER_NAME" IIS server variable so that it shows whatever one want. Other third party web applications or web services may also be vulnerable if authentication depends on the validity this server variable. IIS 6.0 is vulnerable to the spoof, but it's 500-100.asp page is not vulnerable.

The IIS server variable that can be spoofed is the "SERVER_NAME", it can be accessed through request.servervariables("SERVER_NAME") with ASP, and HttpContext.Current.Request.ServerVariables("SERVER_NAME") with .NET, other programming languages have other methods to access this server variable, but are equally vulnerable.

If the HTTP request comes from a remote client, then the server variable "SERVER_NAME" returns the IP address of the web server itself. If the HTTP request came from the same IP as the web server (thus the request came from the an authenticated user browsing from the web server itself), then request.servervariables("SERVER_NAME") returns "localhost". This fact is used as "proof" in web applications or web services that the person browsing the web server is in fact browsing from the web server itself. The web applications or web services may use this proof to display an administrative interface to the web browser user if such is the case. One exploitable example is the IIS 5.x 500-100.asp page(Note: the IIS 6.0 500-100.asp page is no vulnerable); the page uses the server variable to determine if to display the code where the error occurred.

The technical description of the server variable is "The server's host name, DNS alias, or IP address as it would appear in self-referencing URLs", it is therefore often used to determine the IP address of the web server itself in once code, this opens up for a range of exploits including cookie-stealing, data redirection, and other URL manipulation issues.

There are many other applications that utilize validity of this server variable, and MSDN holds many examples for developers that are easily exploitable with this bug; among the most serious are the Microsoft® .NET Passport SDK examples, any web application or web service based on these examples are probably vulnerable due to the bug.

Vendor Status: Notified 28. January 2005 but still no fix availible.

Confirmed applications: Microsoft® Internet Information Server® 5.0, Microsoft® Internet Information Server® 5.1 and Microsoft® Internet Information Server® 6.0.

Confirmed platforms: Microsoft® Windows® 2000 with SP4, Microsoft® Windows® XP Professional with SP2, Microsoft® Windows® 2003 with SP1.

Proof of concept #1
Ok, you will need some sort of telnet client for this:

1. Create a ASP called test.asp on the IIS web root and add the following code:
<% response.write request.servervariables("SERVER_NAME") %>

2. Try and access it from a remote server with telnet. Use the following HTTP request(Note: always do a double ENTER after a HTTP request to indicate end of request message):
GET /test.asp HTTP/1.0

3. The reply is the IP address of the web server, as one would expect.
4. Try and access it from the webserver itself. Use the following HTTP request:
GET /test.asp HTTP/1.0

5. The reply is "localhost", as one would expect.
6. Try and access it from a remote server with telnet again. This time use the following HTTP request:
GET http://localhost/test.asp HTTP/1.0

7. It replies "localhost", you have just fooled IIS to think that the HTTP request came from a user browsing from the web server itself.


Proof of concept #2
This PoC will show you how to get IIS 5.x to reveal code in a page that is not functioning correctly by tricking IIS's 500-100.asp to think that the HTTP request came from the webserver itself. In the IIS page 500-100.asp that reveals the ASP code if an error occurres. The 500-100.asp code snip looks like this(take especially note of the bold letters):

--- Snip from the IIS file /IISHelp/common/500-100.asp ---
strServername = LCase(Request.ServerVariables("SERVER_NAME"))
strServerIP = Request.ServerVariables("LOCAL_ADDR")
strRemoteIP = Request.ServerVariables("REMOTE_ADDR")
If (strServername = "localhost" Or strServerIP = strRemoteIP) And objASPError.File <> "?" Then
Response.Write Server.HTMLEncode(objASPError.File)
If objASPError.Line > 0 Then Response.Write ", line " & objASPError.Line
If objASPError.Column > 0 Then Response.Write ", column " &
objASPError.Column Response.Write "
"

Response.Write "
new"">"
Response.Write Server.HTMLEncode(objASPError.Source) & "
"

If objASPError.Column > 0 Then Response.Write String((objASPError.Column - 1),
"-") & "^
"

Response.Write "
"

blnErrorWritten = True
End If
...

Here you see that Microsoft® assumes that if the Request.ServerVariables("SERVER_NAME") equals "localhost"then the code where the bug happened is returned to the client making the HTTP request.
A normal HTTP request might look like this:
GET /test.asp HTTP/1.0

But by adding "http://localhost/" then you will see that the contents of Request.ServerVariables("SERVER_NAME") changes to "localhost". Like this:
GET http://localhost/test.asp HTTP/1.0

Not only localhost works, one can fake it to anything:
GET http://www.someserver.xom/test.asp HTTP/1.0
GET http://198.2.168.1/test.asp HTTP/1.0

Now, armed with this knowledge, let us ge down-and dirty to reveal some code remotely:

1. Create a global.asa file on the root of your IIS web root that has the following contents:


2. Try and access the web from a remote server with telnet. Use the following HTTP request:
GET / HTTP/1.0

3. The reply does not reveal the code on the "Application("SQLConn")..." line, as it should since IIS 5.x recognizes you as beeing on a remote client. It does however tell you that there is a error on the page.

4. Now try the following HTTP request instead:
GET http://localhost/ HTTP/1.0

5. The reply displays the code, since the IIS server thinks you are browsing from the webserver:

Microsoft VBScript compilation (0x800A03EA) Syntax error 127.0.0.1//global.asa, line 3, column 34
Application("SQLConn") = Provider='sqloledb';Data Source=192.168.2.1;Initial Catalog=Test;User Id=someuser;Password=somepassword;"

---------------------------------^

Links
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/iissdk/html/21b3be8f-d4ed-4059-8e21-6cba2c253006.asp

SQL Server Tips

Performance Tuning SQL Server CE

Windows Server 2008 Product Overview

Windows Server 2008 Product Overview

Improvements to the Windows Server Operating SystemImprovements to the Windows Server Operating System
Benefits of Windows Server 2008Benefits of Windows Server 2008
Windows Server 2008 TechnologiesWindows Server 2008 Technologies
Windows Server 2008 and Windows Vista Better TogetherWindows Server 2008 and Windows Vista Better Together

Microsoft Windows Server 2008 is the next generation of the Windows Server operating system that helps information technology (IT) professionals maximize control over their infrastructure while providing unprecedented availability and management capabilities, leading to a significantly more secure, reliable, and robust server environment than ever before. Windows Server 2008 delivers new value to organizations by ensuring all users regardless of location are able to get the full complement of services from the network. Windows Server 2008 also provides deep insight into the operating system and diagnostic capabilities to allow administrators to spend more time adding business value.

Windows Server 2008 builds on the success and strengths of the award-winning Windows Server 2003 operating system and on the innovations delivered in Service Pack 1 and Windows Server 2003 R2. However, Windows Server 2008 is far more than a refinement of predecessor operating systems. Windows Server 2008 is designed to provide organizations with the most productive platform for powering applications, networks, and Web services from the workgroup to the datacenter with exciting, valuable new functionality and powerful improvements to the base operating system.

Improvements to the Windows Server Operating System

In addition to new functionality, Windows Server 2008 provides powerful improvements to the base operating system over Windows Server 2003. Notable improvements include those to networking, advanced security features, remote application access, centralized server role management, performance and reliability monitoring tools, failover clustering, deployment, and the file system. These improvements and many others help organizations maximize the flexibility, availability, and control of their servers.



BenefitDescription

Web

Windows Server 2008 gives you the ability to deliver rich web-based experiences efficiently and effectively, with improved administration and diagnostics, development and application tools, and lower infrastructure costs.

Simplified Web server management with Internet Information Services 7.0, which is a powerful Web platform for applications and services. This modular platform provides a simplified, task-based management interface, greater cross-site control, security enhancements, and integrated health management for Web services.

Task based interface simplifies common management Web server tasks.

Cross-site copy allows you to easily copy Web site settings across multiple Web servers without additional configuration.

Delegated administration of applications and sites so you can give control to different parts of the Web server to those who need it.

Deliver flexible and comprehensive applications that connect users to each other and their data, enabling them to visualize, share, and act on information.

Virtualization

With its built-in server virtualization technology, Windows Server 2008 enables you to reduce costs, increase hardware utilization, optimize your infrastructure, and improve server availability.

Built-in virtualization to virtualize multiple operating systems—Windows, Linux and others—on a single server. With virtualization built into the operating system and with simpler, more flexible licensing policies, it's now easier than ever to take advantage of all the benefits and cost savings of virtualization.

Centralized application access and seamless integration of remotely published applications. Improvements also add the ability to connect to remote applications across firewalls and without the use of a VPN, so you can quickly respond to the needs of your users, regardless of their location.

New deployments options to provide the most suitable method for your environment.

Interoperability with your existing environment.

Robust and vibrant technical community to provide a rich experience throughout the product life cycle.

Security

Windows Server 2008 is the most secure Windows Server ever. Its hardened operating system and security innovations, including Network Access Protection, Federated Rights Management, and Read-Only Domain Controller, provide unprecedented levels of protection for your network, your data, and your business.

Protection of your server with security innovations that reduce attack surface area of the kernel, resulting in a more robust and secure server environment.

Protection of your network access with Network Access Protection that gives you the power to isolate computers that don't comply with security policies you set. The ability to enforce security requirements is a powerful means of protecting your network.

Enhanced solutions for intelligent rules and policies creation to increase control and protection over networking functions, allowing you to have a policy-driven network.

Protection of your data to ensure it can only be accessed by users with the correct security context, and to make it available when hardware failures occur.

Protection against malicious software with User Account Control with a new authentication architecture.

Increased control over your user settings with Expanded Group Policy.

Solid Foundation for Business Workloads

Windows Server 2008 is the most flexible and robust Windows Server operating system to date. With new technologies and features such as Server Core, PowerShell, Windows Deployment Services, and enhanced networking and clustering technologies, Windows Server 2008 provides you the most versatile and reliable Windows platform for all of your workload and application requirements.

Increased dependability with advanced reliability enhancements to reduce loss of access, work, time, data, and control.

Simplified management of your IT infrastructure by using new tools that provide a one-stop interface for server configuration and monitoring, as well as the ability to automate routine tasks.

Streamlined installation and management of Windows Server 2008 by installing only the roles and features you need. The customization of the server configuration simplifies ongoing maintenance by minimizing the attack surface area and reducing the need for software updates.

Effectively pinpointing and resolving trouble spots with powerful diagnostic tools that give you ongoing visibility into your server environment, both physical and virtual.

Increased control over servers located in remote locations, such as the branch office. With optimized server administration and data replication, you can provide users with better service while reducing management headaches.





Windows Server 2008 Technologies

Web

Windows Server 2008 gives you the ability to deliver rich Web-based experiences efficiently and effectively, with improved administration and diagnostics, development and application tools, and lower infrastructure costs.

Internet Information Services 7.0: Windows Server 2008 delivers a unified platform for Web publishing that integrates Internet Information Services (IIS) 7.0, ASP.NET, Windows Communication Foundation, Windows Workflow Foundation, and Windows SharePoint Services 3.0. IIS 7.0 is a major enhancement to the existing Windows Web server and plays a central role in integrating Web platform technologies. IIS 7.0 helps developers and administrators alike maximize their control over network/Internet interfaces through key functionality pillars that include delegated administration, enhanced security and a reduced attack surface area, integrated application and health management for Web services, and improved administration tools.

Virtualization

With its built-in server virtualization technology, Windows Server 2008 enables you to reduce costs, increase hardware utilization, optimize your infrastructure, and improve server availability.

Terminal Services: Windows Server 2008 introduces new functionality in Terminal Services to connect to remote computers and applications. Terminal Services RemoteApp completely integrates applications running on a terminal server with users' desktops such that they behave as if they were running on an individual user's local computer; users can run programs from a remote location side-by-side with their local programs. Terminal Services Web Access permits this same flexibility of remote application access via Web browser, granting an even wider variety of ways user can access and use programs executing on a terminal server. These features in conjunction with Terminal Services Gateway allow users to access remote desktops and remote applications via HTTPS in a firewall-friendly manner.

Security

Windows Server 2008 is the most secure Windows Server ever. Its hardened operating system and security innovations, including Network Access Protection, Federated Rights Management, and Read-Only Domain Controller, provide unprecedented levels of protection for your network, your data, and your business.

Network Access Protection (NAP): A new framework that allows an IT administrator to define health requirements for the network and to restrict computers that do not meet these requirements from communicating with the network. NAP enforces administrator-defined policies that describe the health requirements for the given organization. For example, health requirements may be defined to include all updates to the operating system be installed, or having antivirus or antispyware software installed and updated. In this way, network administrators can define the baseline level of protection all computers carry when connecting to the network.

Microsoft BitLocker provides additional security for your data through full volume encryption on multiple drives, even when the system is in unauthorized hands or running a different operating system time, data, and control.

Read-Only Domain Controller (RODC): A new type of domain controller configuration in the Windows Server 2008 operating system that makes it possible for organizations to easily deploy a domain controller in locations where the physical security of a domain controller cannot be guaranteed. An RODC hosts a read-only replica of the Active Directory directory services database for a given domain. Prior to this release, users who had to authenticate with a domain controller, but were in a branch office that could not provide adequate physical security for a domain controller, had to authenticate over a wide area network (WAN). In many cases, this was not an efficient solution. By placing a read-only Active Directory database replica closer to branch users, these users can benefit from faster logon times and more efficient access to authentication resources on the network, even in environments with inadequate physical security to deploy a traditional domain controller.

Failover Clustering: Improvements are aimed to makes it easier to configure server clusters while providing protection and availability of your data and applications. By using the new Validate Tool in failover clusters, you can perform tests to determine whether your system, storage, and network configuration is suitable for a cluster. With failover clusters in Windows Server 2008, administrators can carry out setup and migration tasks, as well as management and operations tasks more easily. Improvements to the cluster infrastructure help administrators maximize availability of the services they provide to users, achieve better storage and network performance and improve security.

Solid Foundation for Business Workloads

Windows Server 2008 is the most flexible and robust Windows Server operating system to date. With new technologies and features such as Server Core, PowerShell, Windows Deployment Services, and enhanced networking and clustering technologies, Windows Server 2008 provides you the most versatile and reliable Windows platform for all of your workload and application requirements.

Server Core: Beginning with the Beta 2 release of Windows Server 2008, administrators can choose to install Windows Server with only the services required to perform the DHCP, DNS, file server, or domain controller roles. This new installation option will not install non-essential services and applications and will provide base server functionality without any extra overhead. While the Server Core installation option is a fully functioning mode of the operating system supporting one of the designate roles, it does not include the server graphic user interface (GUI). Because Server Core installations include only what is required for the designated roles, a Server Core installation will typically require less maintenance and fewer updates as there are fewer components to manage. In other words, since there are fewer programs and components installed and running on the server, there are fewer attack vectors exposed to the network, resulting in a reduced attack surface. If a security flaw or vulnerability is discovered in a component that is not installed, a patch is not required.

Windows PowerShell: A new command-line shell with over 130 tools and an integrated scripting language. It enables administrator to more easily control and securely automate routine system administration tasks, especially across multiple servers. Windows PowerShell does not require you to migrate your existing scripts, and it is ideally suited for automation of new Windows Server 2008 features. A new admin-focused scripting language, and consistent syntax and utilities, Windows PowerShell accelerates automation of system administration tasks—such as Active Directory, Terminal Server, and Internet Information Server (IIS) 7.0—and improves your organization's ability to address the unique system management problems of your environment.

Windows PowerShell is easy to adopt, learn, and use, because it does not require a background in programming, and it works with your existing IT infrastructure, existing scripts, and existing command-line tools.

Server Manager: A new feature that is included in Windows Server 2008. It is a "one-stop-shop" designed to guide Information Technology administrators through the end-to-end process of installing, configuring, and managing server roles and features that are part of Windows Server 2008. Server Manager replaces and consolidates a number of features from Microsoft Windows Server 2003 such as Manage Your Server, Configure Your Server, and Add or Remove Windows Components. You can use Server Manager to configure various "roles" and "features" on your machine.

Windows Deployment Services (WDS): An updated and redesigned Windows Server 2008 version of Remote Installation Services (RIS), WDS assists with the rapid adoption and deployment of image-based Windows operating systems. WDS allows network-based installation of Windows Vista and Windows Server 2008 to "bare metal" computers (no operating system installed), and even supports mixed environments including Microsoft Windows XP and Microsoft Windows Server 2003. Windows Deployment Services thus provides an end-to-end solution for deployment of Windows operating systems to client and server computers and reduces the total cost of ownership (TCO) and complexity of Windows Server 2008 and Windows Vista deployments.

Windows Server 2008 and Windows Vista Better Together

Windows Vista and Windows Server 2008 originally began as part of a single development project, and as such they share a number of new technologies across networking, storage, security and management. Although the development of Windows Vista and Windows Server 2008 have branched into separate releases with different release cycles, many of these enhancements apply to both Windows Vista and Windows Server 2008. When organizations deploy both operating systems, they will see how the combined client-server infrastructure provides even greater advantages.

Features

IT professionals who are administering a Windows Vista / Windows Server 2008 infrastructure will notice many improvements in how they control and manage their environment.

Maintenance is greatly simplified by the use of a single model for updates and service packs across client and server.

Client computers can monitor for specific events and forward to Windows Server 2008 for centralized monitoring and reporting.

Windows Deployment Services provides much faster and more reliable operating system deployment.

Network Access Protection features on Windows Server 2008 ensure that Windows Vista clients connecting to the network are compliant with security policies and restricted from accessing network resources if not.

The reliability, scalability, and overall responsiveness of the infrastructure are greatly increased by improvements made to both Windows Vista and Windows Server 2008.

Clients can render print jobs locally before sending them to print servers to reduce the load on the server and increase its availability.

Server resources are cached locally so that they are available even if the server is not, with copies automatically updating when the client and server are reconnected.

Applications or scripts that need to run on both client and server can take advantage of the Transactional File System to reduce the risk of error during file and registry operations and roll back to a known good state in the event of failure or cancellation.

Policies can be created to ensure greater Quality of Service for certain applications or services that require prioritization of network bandwidth between client and server.

Windows Vista clients connecting to networks where Windows Server 2008 has been deployed can experience greatly improved communication speeds and reliability.

Searching Windows Server 2008 servers from a Windows Vista client avails of enhanced indexing and caching technologies on both to provide huge performance gains across the enterprise.

Native IPv6 support across all client and server services creates a more scalable and reliable network, while the rewritten TCP/IP stack makes network communication much faster and more efficient.

The new Server Message Block 2.0 protocol provides a number of communication enhancements, including greater performance when connecting to file shares over high-latency links and better security through the use of mutual authentication and message signing.

Terminal Services on Windows Server 2008 have many improvements, including providing Windows Vista clients with remote access to internal resources through an HTTP gateway and seamless remote applications that run as if on the local desktop.

Get an early look at Visual Studio 2008

The next version of Visual Studio, Microsoft® Visual Studio® 2008, will provide an industry-leading developer experience for Windows Vista, the 2007 Microsoft Office system, and the Web. In addition, it will continue in the Microsoft tradition of development language innovation. To enable early feedback, this page provides links to prerelease versions of Visual Studio 2008, and for technologies that we plan to include in it. As previews of additional technologies become available, we will make them available from this page.

The Beta 2 release includes most of the products found in the Visual Studio product line. As with all prerelease software, we encourage you only to install these on a secondary machine, or in a virtual machine, as they are not supported by Microsoft Services support teams. As the goal of these previews is to gather feedback from the developer community, please use Microsoft Connect to report any issues, or to suggest improvements. MSDN Subscribers can also download these files from MSDN Subscriber Downloads.

Files & Disc Images for Self-installation

If you prefer to install the software yourself, you can download separate disc images for the following products:

IMPORTANT:

  • After the Beta 2 installation has finished, you should run this script to ensure that the installation of .NET Framework 3.5 Beta 2 will not affect the development of ASP.NET AJAX 1.0 applications.
  • To install Team Foundation Server, you must follow the steps and system requirements details on the download page.
  • When installing prerelease software, we advise that you do not install it on a production machine.

VPC Images with Pre-installed Software

If you prefer the convenience of evaluating prerelease software in a virtual machine environment, you can download VPC images for the following products that include pre-installed instances of the prerelease software indicated, including any required prerequisite software. You will need Virtual PC or Virtual Server to run this image. Depending on your hardware, the download files make take between 30-60 minutes to decompress these self-extracting files.

IMPORTANT:

  • After extracting and opening the VPC, you should run this script to ensure that the installation of .NET Framework 3.5 Beta 2 will not affect the development of ASP.NET AJAX 1.0 applications.
  • These downloads are differencing disks. To use them, you must also download Visual Studio Code Name Orcas Base Image contains the OS and is a one-time download for all the Virtual PC images that lay on top of it.

For previous relelases, see Archived Downloads.



Courtesy by microsoft.com

Top 15 Interview Questions

You should have answers prepared for these questions.

  1. Describe your ideal job and/or boss.
  2. Why are you looking for a job? Why are leaving your current position?
  3. What unique experience or qualifications separate you from other candidates?
  4. Tell me about yourself.
  5. What are your strengths and weaknesses?
  6. Describe some of your most important career accomplishments.
  7. What are your short-term/long-term goals?
  8. Describe a time when you were faced with a challenging situation and how you handled it.
  9. What are your salary requirements?
  10. Why are you interested in this position? Our company?
  11. What would your former boss/colleagues say about you?
  12. What are the best and worst aspects of your previous job?
  13. What do you know about our company?
  14. What motivates you? How do you motivate others?
  15. Are you willing to relocate?
Don't forget to write a brief ‘Thank You’ note to the person or people who interviewed you. You may be the only candidate who performed this small courtesy!

SQL Server DataType

All Sql DataType

bigint
Integer data from -2^63 through 2^63-1

binary
Fixed-length binary data with a maximum length of 8,000 bytes

bit

Integer data with either a 1 or 0 value

char
Fixed-length character data with a maximum length of 8,000 characters

datetime

Date and time data from January 1, 1753, through December 31, 9999,with an accuracy of 3.33 milliseconds

decimal

Fixed precision and scale numeric data from -10^38 +1 through 10^38 -1

float
Floating precision number data from -1.79E + 308 through 1.79E + 308

image

Variable-length binary data with a maximum length of 2^31 - 1 bytes

int
Integer data from -2^31 through 2^31 - 1

money
Monetary data values from -2^63 through 2^63 - 1

nchar
Fixed-length Unicode data with a maximum length of 4,000 characters

ntext
Variable-length Unicode data with a maximum length of 2^30 - 1 characters

nvarchar

Variable-length Unicode data with a maximum length of 4,000 characters

numeric

Fixed precision and scale numeric data from -10^38 +1 through 10^38 -1

real
Floating precision number data from -3.40E + 38 through 3.40E + 38

smalldatetime

Date and time data from January 1, 1900, through June 6, 2079,with an accuracy of one minute

smallint

Integer data from -2^15 through 2^15 - 1

smallmoney
Monetary data values from -214,748.3648 through +214,748.3647

sysname

text

Variable-length data with a maximum length of 2^31 - 1 characters

timestamp

tinyint

Integer data from 0 through 255

varbinary
Variable-length binary data with a maximum length of 8,000 bytes

varchar

Variable-length data with a maximum of 8,000 characters

uniqueidentifier

A globally unique identifier

How to make a $100 per day

I just realized something! This entire blog is filled with ideas on how to help your sites make more money and receive more traffic, but I don’t have a single post that says, HEY! HERE IS HOW YOU MAKE MONEY. I want a post that tells you exactly how to reach your goals. A comment in another post (I do read them and get inspired by them) reminded me of this. So I perused through some old projects of mine and grabbed one thats very easy, very automated, reciprocal (consistantly makes money forever), and makes about a $100/day. Most of all it requires very minimal time and investment. So here ya go! Follow the instructions carefully and do as I did.

Here Is What You Do

1) Pick a generalized niche that is fairly popular. Celebrities work well, cars, animals. Anything will do.

2) Make a list of 300 items in that niche. For instance if you pick music artists make a list of the top 300 most popular music artists.

3) Download at least 20 public use(noncopyrighted) pictures of each item in your list.

4) Download or buy a screensaver maker. I don’t remember which one I use so I’ll have to update you in the comments when I get back to the office on Monday. Just make sure it is quick and easy to create the screensavers (saves you a lot of time) and comes with an exe output function that’ll easily install the screensavers on their computer without much dialog boxes or windows getting in thier way. This one looks decent. Easy Screensaver Maker and its only $25. Update: I use Screen Saver Builder. It’s $20 with fully functioning 21 day trial.

5)
Create all your screensavers and put them up on a simple website. Give each screensaver its own page and download link. It also never hurts to SEO the site so it’ll do well in the search engines and make you even more money later on. Adsense also doesn’t hurt for a lil’ bit of extra cash.

6) Signup with Zangocash (Aff Link). This step is optional. See the comments for more ideas on how to monenize your new screensavers.

7)
Talk to your account manager and ask him to bundle Zango software with your screensavers. Send him all the installers along with a textfile containing all the short descriptions and a sample picture. They are usually happy to do this for you. If they aren’t get a new account manager.

8)
Get yourself a copy of Promosoft software submitter(nonAff link). I think it costs $95 for a copy but trust me it’s well worth it.

9) Follow the instructions on Promosoft to create the PAD files(product description files used for software sites) and submit each screensaver to hundreds of software and screensaver directories.

There you go. You will get paid $0.45 for every person who installs your screensaver. Once the screensavers are submitted you will have no problem getting tons of people downloading them everyday. If you get about 250 downloads per day(easy with 300 screensavers) you will easily make about a $100/day!

Okay so now all those people on forums and such who are bitching and moaning; saying stuff like “I want to quit my day job” and “I wish I could make a living online” can finally shut up. It is all right there, spelled out in plain english. You now have absolutely no excuses. Get off your ass and actually do it. Follow each step carefully and do a good job. It should take the average person no more than a couple days to get it done and you will make continuous money for a very long time. If you’re reading this and you suddenly realize that you are one of those people, just know that there is nothing wrong with that. We were all there. You just have to know when to quit. Quit searching forums for ideas. Quit buying ebooks hoping they’ll give that magical $100/day project idea. Quit asking “SEO experts” how they do it, and for God’s sake quit reading blogs hoping someone will post something like this, cus it just ain’t gonna happen(haha). All I expect from you is to read this post throughly and carefully at least two more times and actually follow through. There is nothing more I would love, than to hear someone tell me that an article I wrote helped them quit their job in the next 8 weeks. So make it happen!

Cursors allow row-by-row prcessing of the resultsets.

Types of cursors: Static, Dynamic, Forward-only, Keyset-driven. See books online for more information.

Disadvantages of cursors: Each time you fetch a row from the cursor, it results in a network roundtrip, where as a normal SELECT query makes only one rowundtrip, however large the resultset is. Cursors are also costly because they require more resources and temporary storage (results in more IO operations). Furthere, there are restrictions on the SELECT statements that can be used with some types of cursors.

Most of the times, set based operations can be used instead of cursors. Here is an example:

If you have to give a flat hike to your employees using the following criteria:

Salary between 30000 and 40000 -- 5000 hike
Salary between 40000 and 55000 -- 7000 hike
Salary between 55000 and 65000 -- 9000 hike

In this situation many developers tend to use a cursor, determine each employee's salary and update his salary according to the above formula. But the same can be achieved by multiple update statements or can be combined in a single UPDATE statement as shown below:

UPDATE tbl_emp SET salary =
CASE WHEN salary BETWEEN 30000 AND 40000 THEN salary + 5000
WHEN salary BETWEEN 40000 AND 55000 THEN salary + 7000
WHEN salary BETWEEN 55000 AND 65000 THEN salary + 10000
END

Another situation in which developers tend to use cursors: You need to call a stored procedure when a column in a particular row meets certain condition. You don't have to use cursors for this. This can be achieved using WHILE loop, as long as there is a unique key to identify each row. For examples of using WHILE loop for row by row processing, check out the 'My code library' section of my site or search for WHILE.

What are external procedures ? Why and when they are used....

I hope external procedures are Extended stored procedures only.they let you create your own external routines in a programming language such as C.Extended stored procedures are DLLs that an instance of Microsoft SQL Server can dynamically load and run.Extended stored procedures run directly in the address space of an instance of SQL Server and are programmed by using the SQL Server Extended Stored Procedure API.

SQL Interview Questions with Answers

What is normalization? Explain different levels of normalization?

Check out the article Q100139 from Microsoft knowledge base and of
course, there's much more information available in the net. It'll be a
good idea to get a hold of any RDBMS fundamentals text book,
especially the one by C. J. Date. Most of the times, it will be okay
if you can explain till third normal form.

What is denormalization and when would you go for it?

As the name indicates, denormalization is the reverse process of
normalization. It's the controlled introduction of redundancy in to
the database design. It helps improve the query performance as the
number of joins could be reduced.

How do you implement one-to-one, one-to-many and many-to-many
relationships while designing tables?

One-to-One relationship can be implemented as a single table and
rarely as two tables with primary and foreign key relationships.
One-to-Many relationships are implemented by splitting the data into
two tables with primary key and foreign key relationships.
Many-to-Many relationships are implemented using a junction table with
the keys from both the tables forming the composite primary key of the
junction table.

It will be a good idea to read up a database designing fundamentals
text book.

What's the difference between a primary key and a unique key?

Both primary key and unique enforce uniqueness of the column on which
they are defined. But by default primary key creates a clustered index
on the column, where are unique creates a nonclustered index by
default. Another major difference is that, primary key doesn't allow
NULLs, but unique key allows one NULL only.

What are user defined datatypes and when you should go for them?

User defined datatypes let you extend the base SQL Server datatypes by
providing a descriptive name, and format to the database. Take for
example, in your database, there is a column called Flight_Num which
appears in many tables. In all these tables it should be varchar(8).
In this case you could create a user defined datatype called
Flight_num_type of varchar(8) and use it across all your tables.

See sp_addtype, sp_droptype in books online.

What is bit datatype and what's the information that can be stored
inside a bit column?

Bit datatype is used to store boolean information like 1 or 0 (true or
false). Untill SQL Server 6.5 bit datatype could hold either a 1 or 0
and there was no support for NULL. But from SQL Server 7.0 onwards,
bit datatype can represent a third state, which is NULL.

Define candidate key, alternate key, composite key.

A candidate key is one that can identify each row of a table uniquely.
Generally a candidate key becomes the primary key of the table. If the
table has more than one candidate key, one of them will become the
primary key, and the rest are called alternate keys.

A key formed by combining at least two or more columns is called
composite key.

What are defaults? Is there a column to which a default can't be bound?

A default is a value that will be used by a column, if no value is
supplied to that column while inserting data. IDENTITY columns and
timestamp columns can't have defaults bound to them. See CREATE
DEFUALT in books online.

Back to top
SQL Server architecture (top)

What is a transaction and what are ACID properties?

A transaction is a logical unit of work in which, all the steps must
be performed or none. ACID stands for Atomicity, Consistency,
Isolation, Durability. These are the properties of a transaction. For
more information and explanation of these properties, see SQL Server
books online or any RDBMS fundamentals text book.

Explain different isolation levels

An isolation level determines the degree of isolation of data between
concurrent transactions. The default SQL Server isolation level is
Read Committed. Here are the other isolation levels (in the ascending
order of isolation): Read Uncommitted, Read Committed, Repeatable
Read, Serializable. See SQL Server books online for an explanation of
the isolation levels. Be sure to read about SET TRANSACTION ISOLATION
LEVEL, which lets you customize the isolation level at the connection
level.

CREATE INDEX myIndex ON myTable(myColumn)

What type of Index will get created after executing the above statement?

Non-clustered index. Important thing to note: By default a clustered
index gets created on the primary key, unless specified otherwise.

What's the maximum size of a row?

8060 bytes. Don't be surprised with questions like 'what is the
maximum number of columns per table'. Check out SQL Server books
online for the page titled: "Maximum Capacity Specifications".

Explain Active/Active and Active/Passive cluster configurations

Hopefully you have experience setting up cluster servers. But if you
don't, at least be familiar with the way clustering works and the two
clusterning configurations Active/Active and Active/Passive. SQL
Server books online has enough information on this topic and there is
a good white paper available on Microsoft site.

Explain the architecture of SQL Server

This is a very important question and you better be able to answer it
if consider yourself a DBA. SQL Server books online is the best place
to read about SQL Server architecture. Read up the chapter dedicated
to SQL Server Architecture.

What is lock escalation?

Lock escalation is the process of converting a lot of low level locks
(like row locks, page locks) into higher level locks (like table
locks). Every lock is a memory structure too many locks would mean,
more memory being occupied by locks. To prevent this from happening,
SQL Server escalates the many fine-grain locks to fewer coarse-grain
locks. Lock escalation threshold was definable in SQL Server 6.5, but
from SQL Server 7.0 onwards it's dynamically managed by SQL Server.

What's the difference between DELETE TABLE and TRUNCATE TABLE commands?

DELETE TABLE is a logged operation, so the deletion of each row gets
logged in the transaction log, which makes it slow. TRUNCATE TABLE
also deletes all the rows in a table, but it won't log the deletion of
each row, instead it logs the deallocation of the data pages of the
table, which makes it faster. Of course, TRUNCATE TABLE can be rolled
back.

Explain the storage models of OLAP

Check out MOLAP, ROLAP and HOLAP in SQL Server books online for more
infomation.

What are the new features introduced in SQL Server 2000 (or the latest
release of SQL Server at the time of your interview)? What changed
between the previous version of SQL Server and the current version?

This question is generally asked to see how current is your knowledge.
Generally there is a section in the beginning of the books online
titled "What's New", which has all such information. Of course,
reading just that is not enough, you should have tried those things to
better answer the questions. Also check out the section titled
"Backward Compatibility" in books online which talks about the changes
that have taken place in the new version.

What are constraints? Explain different types of constraints.

Constraints enable the RDBMS enforce the integrity of the database
automatically, without needing you to create triggers, rule or defaults.

Types of constraints: NOT NULL, CHECK, UNIQUE, PRIMARY KEY, FOREIGN KEY

For an explanation of these constraints see books online for the pages
titled: "Constraints" and "CREATE TABLE", "ALTER TABLE"

Whar is an index? What are the types of indexes? How many clustered
indexes can be created on a table? I create a separate index on each
column of a table. what are the advantages and disadvantages of this
approach?

Indexes in SQL Server are similar to the indexes in books. They help
SQL Server retrieve the data quicker.

Indexes are of two types. Clustered indexes and non-clustered indexes.
When you craete a clustered index on a table, all the rows in the
table are stored in the order of the clustered index key. So, there
can be only one clustered index per table. Non-clustered indexes have
their own storage separate from the table data storage. Non-clustered
indexes are stored as B-tree structures (so do clustered indexes),
with the leaf level nodes having the index key and it's row locater.
The row located could be the RID or the Clustered index key, depending
up on the absence or presence of clustered index on the table.

If you create an index on each column of a table, it improves the
query performance, as the query optimizer can choose from all the
existing indexes to come up with an efficient execution plan. At the
same t ime, data modification operations (such as INSERT, UPDATE,
DELETE) will become slow, as every time data changes in the table, all
the indexes need to be updated. Another disadvantage is that, indexes
need disk space, the more indexes you have, more disk space is used.

Back to top
Database administration (top)

What is RAID and what are different types of RAID configurations?

RAID stands for Redundant Array of Inexpensive Disks, used to provide
fault tolerance to database servers. There are six RAID levels 0
through 5 offering different levels of performance, fault tolerance.
MSDN has some information about RAID levels and for detailed
information, check out the RAID advisory board's homepage

What are the steps you will take to improve performance of a poor
performing query?

This is a very open ended question and there could be a lot of reasons
behind the poor performance of a query. But some general issues that
you could talk about would be: No indexes, table scans, missing or out
of date statistics, blocking, excess recompilations of stored
procedures, procedures and triggers without SET NOCOUNT ON, poorly
written query with unnecessarily complicated joins, too much
normalization, excess usage of cursors and temporary tables.

Some of the tools/ways that help you troubleshooting performance
problems are: SET SHOWPLAN_ALL ON, SET SHOWPLAN_TEXT ON, SET
STATISTICS IO ON, SQL Server Profiler, Windows NT /2000 Performance
monitor, Graphical execution plan in Query Analyzer.

Download the white paper on performance tuning SQL Server from
Microsoft web site. Don't forget to check out sql-server-performance.com

What are the steps you will take, if you are tasked with securing an
SQL Server?

Again this is another open ended question. Here are some things you
could talk about: Preferring NT authentication, using server, databse
and application roles to control access to the data, securing the
physical database files using NTFS permissions, using an unguessable
SA password, restricting physical access to the SQL Server, renaming
the Administrator account on the SQL Server computer, disabling the
Guest account, enabling auditing, using multiprotocol encryption,
setting up SSL, setting up firewalls, isolating SQL Server from the
web server etc.

Read the white paper on SQL Server security from Microsoft website.
Also check out My SQL Server security best practices

What is a deadlock and what is a live lock? How will you go about
resolving deadlocks?

Deadlock is a situation when two processes, each having a lock on one
piece of data, attempt to acquire a lock on the other's piece. Each
process would wait indefinitely for the other to release the lock,
unless one of the user processes is terminated. SQL Server detects
deadlocks and terminates one user's process.

A livelock is one, where a request for an exclusive lock is
repeatedly denied because a series of overlapping shared locks keeps
interfering. SQL Server detects the situation after four denials and
refuses further shared locks. A livelock also occurs when read
transactions monopolize a table or page, forcing a write transaction
to wait indefinitely.

Check out SET DEADLOCK_PRIORITY and "Minimizing Deadlocks" in SQL
Server books online. Also check out the article Q169960 from Microsoft
knowledge base.

What is blocking and how would you troubleshoot it?

Blocking happens when one connection from an application holds a lock
and a second connection requires a conflicting lock type. This forces
the second connection to wait, blocked on the first.

Read up the following topics in SQL Server books online: Understanding
and avoiding blocking, Coding efficient transactions.

Explain CREATE DATABASE syntax

Many of us are used to craeting databases from the Enterprise Manager
or by just issuing the command: CREATE DATABAE MyDB. But what if you
have to create a database with two filegroups, one on drive C and the
other on drive D with log on drive E with an initial size of 600 MB
and with a growth factor of 15%? That's why being a DBA you should be
familiar with the CREATE DATABASE syntax. Check out SQL Server books
online for more information.

How to restart SQL Server in single user mode? How to start SQL Server
in minimal configuration mode?

SQL Server can be started from command line, using the SQLSERVR.EXE.
This EXE has some very important parameters with which a DBA should be
familiar with. -m is used for starting SQL Server in single user mode
and -f is used to start the SQL Server in minimal confuguration mode.
Check out SQL Server books online for more parameters and their
explanations.

As a part of your job, what are the DBCC commands that you commonly
use for database maintenance?

DBCC CHECKDB, DBCC CHECKTABLE, DBCC CHECKCATALOG, DBCC CHECKALLOC,
DBCC SHOWCONTIG, DBCC SHRINKDATABASE, DBCC SHRINKFILE etc. But there
are a whole load of DBCC commands which are very useful for DBAs.
Check out SQL Server books online for more information.

What are statistics, under what circumstances they go out of date, how
do you update them?

Statistics determine the selectivity of the indexes. If an indexed
column has unique values then the selectivity of that index is more,
as opposed to an index with non-unique values. Query optimizer uses
these indexes in determining whether to choose an index or not while
executing a query.

Some situations under which you should update statistics:
1) If there is significant change in the key values in the index
2) If a large amount of data in an indexed column has been added,
changed, or removed (that is, if the distribution of key values has
changed), or the table has been truncated using the TRUNCATE TABLE
statement and then repopulated
3) Database is upgraded from a previous version

Look up SQL Server books online for the following commands: UPDATE
STATISTICS, STATS_DATE, DBCC SHOW_STATISTICS, CREATE STATISTICS, DROP
STATISTICS, sp_autostats, sp_createstats, sp_updatestats

What are the different ways of moving data/databases between servers
and databases in SQL Server?

There are lots of options available, you have to choose your option
depending upon your requirements. Some of the options you have are:
BACKUP/RESTORE, dettaching and attaching databases, replication, DTS,
BCP, logshipping, INSERT...SELECT, SELECT...INTO, creating INSERT
scripts to generate data.

Explian different types of BACKUPs avaialabe in SQL Server? Given a
particular scenario, how would you go about choosing a backup plan?

Types of backups you can create in SQL Sever 7.0+ are Full database
backup, differential database backup, transaction log backup,
filegroup backup. Check out the BACKUP and RESTORE commands in SQL
Server books online. Be prepared to write the commands in your
interview. Books online also has information on detailed
backup/restore architecture and when one should go for a particular
kind of backup.

What is database replicaion? What are the different types of
replication you can set up in SQL Server?

Replication is the process of copying/moving data between databases on
the same or different servers. SQL Server supports the following types
of replication scenarios:

* Snapshot replication
* Transactional replication (with immediate updating subscribers,
with queued updating subscribers)
* Merge replication

See SQL Server books online for indepth coverage on replication. Be
prepared to explain how different replication agents function, what
are the main system tables used in replication etc.

How to determine the service pack currently installed on SQL Server?

The global variable @@Version stores the build number of the
sqlservr.exe, which is used to determine the service pack installed.
To know more about this process visit SQL Server service packs and
versions.

Back to top
Database programming (top)

What are cursors? Explain different types of cursors. What are the
disadvantages of cursors? How can you avoid cursors?

Cursors allow row-by-row prcessing of the resultsets.

Types of cursors: Static, Dynamic, Forward-only, Keyset-driven. See
books online for more information.

Disadvantages of cursors: Each time you fetch a row from the cursor,
it results in a network roundtrip, where as a normal SELECT query
makes only one rowundtrip, however large the resultset is. Cursors are
also costly because they require more resources and temporary storage
(results in more IO operations). Furthere, there are restrictions on
the SELECT statements that can be used with some types of cursors.

Most of the times, set based operations can be used instead of
cursors. Here is an example:

If you have to give a flat hike to your employees using the following
criteria:

Salary between 30000 and 40000 -- 5000 hike
Salary between 40000 and 55000 -- 7000 hike
Salary between 55000 and 65000 -- 9000 hike

In this situation many developers tend to use a cursor, determine each
employee's salary and update his salary according to the above
formula. But the same can be achieved by multiple update statements or
can be combined in a single UPDATE statement as shown below:

UPDATE tbl_emp SET salary =
CASE WHEN salary BETWEEN 30000 AND 40000 THEN salary + 5000
WHEN salary BETWEEN 40000 AND 55000 THEN salary + 7000
WHEN salary BETWEEN 55000 AND 65000 THEN salary + 10000
END

Another situation in which developers tend to use cursors: You need to
call a stored procedure when a column in a particular row meets
certain condition. You don't have to use cursors for this. This can be
achieved using WHILE loop, as long as there is a unique key to
identify each row. For examples of using WHILE loop for row by row
processing, check out the 'My code library' section of my site or
search for WHILE.

Write down the general syntax for a SELECT statements covering all the
options.

Here's the basic syntax: (Also checkout SELECT in books online for
advanced syntax).

SELECT select_list
[INTO new_table_]
FROM table_source
[WHERE search_condition]
[GROUP BY group_by__expression]
[HAVING search_condition]
[ORDER BY order__expression [ASC | DESC] ]

What is a join and explain different types of joins.

Joins are used in queries to explain how different tables are related.
Joins also let you select data from a table depending upon data from
another table.

Types of joins: INNER JOINs, OUTER JOINs, CROSS JOINs. OUTER JOINs are
further classified as LEFT OUTER JOINS, RIGHT OUTER JOINS and FULL
OUTER JOINS.

For more information see pages from books online titled: "Join
Fundamentals" and "Using Joins".

Can you have a nested transaction?

Yes, very much. Check out BEGIN TRAN, COMMIT, ROLLBACK, SAVE TRAN and
@@TRANCOUNT

What is an extended stored procedure? Can you instantiate a COM object
by using T-SQL?

An extended stored procedure is a function within a DLL (written in a
programming language like C, C++ using Open Data Services (ODS) API)
that can be called from T-SQL, just the way we call normal stored
procedures using the EXEC statement. See books online to learn how to
create extended stored procedures and how to add them to SQL Server.

Yes, you can instantiate a COM (written in languages like VB, VC++)
object from T-SQL by using sp_OACreate stored procedure. Also see
books online for sp_OAMethod, sp_OAGetProperty, sp_OASetProperty,
sp_OADestroy. For an example of creating a COM object in VB and
calling it from T-SQL, see 'My code library' section of this site.

What is the system function to get the current user's user id?

USER_ID(). Also check out other system functions like USER_NAME(),
SYSTEM_USER, SESSION_USER, CURRENT_USER, USER, SUSER_SID(), HOST_NAME().

What are triggers? How many triggers you can have on a table? How to
invoke a trigger on demand?

Triggers are special kind of stored procedures that get executed
automatically when an INSERT, UPDATE or DELETE operation takes place
on a table.

In SQL Server 6.5 you could define only 3 triggers per table, one for
INSERT, one for UPDATE and one for DELETE. From SQL Server 7.0
onwards, this restriction is gone, and you could create multiple
triggers per each action. But in 7.0 there's no way to control the
order in which the triggers fire. In SQL Server 2000 you could specify
which trigger fires first or fires last using sp_settriggerorder

Triggers can't be invoked on demand. They get triggered only when an
associated action (INSERT, UPDATE, DELETE) happens on the table on
which they are defined.

Triggers are generally used to implement business rules, auditing.
Triggers can also be used to extend the referential integrity checks,
but wherever possible, use constraints for this purpose, instead of
triggers, as constraints are much faster.

Till SQL Server 7.0, triggers fire only after the data modification
operation happens. So in a way, they are called post triggers. But in
SQL Server 2000 you could create pre triggers also. Search SQL Server
2000 books online for INSTEAD OF triggers.

Also check out books online for 'inserted table', 'deleted table' and
COLUMNS_UPDATED()

There is a trigger defined for INSERT operations on a table, in an
OLTP system. The trigger is written to instantiate a COM object and
pass the newly insterted rows to it for some custom processing. What
do you think of this implementation? Can this be implemented better?

Instantiating COM objects is a time consuming process and since you
are doing it from within a trigger, it slows down the data insertion
process. Same is the case with sending emails from triggers. This
scenario can be better implemented by logging all the necessary data
into a separate table, and have a job which periodically checks this
table and does the needful.

What is a self join? Explain it with an example.

Self join is just like any other join, except that two instances of
the same table will be joined in the query. Here is an example:
Employees table which contains rows for normal employees as well as
managers. So, to find out the managers of all the employees, you need
a self join.

CREATE TABLE emp
(
empid int,
mgrid int,
empname char(10)
)

INSERT emp SELECT 1,2,'Vyas'
INSERT emp SELECT 2,3,'Mohan'
INSERT emp SELECT 3,NULL,'Shobha'
INSERT emp SELECT 4,2,'Shridhar'
INSERT emp SELECT 5,2,'Sourabh'

SELECT t1.empname [Employee], t2.empname [Manager]
FROM emp t1, emp t2
WHERE t1.mgrid = t2.empid

Here's an advanced query using a LEFT OUTER JOIN that even returns the
employees without managers (super bosses)

SELECT t1.empname [Employee], COALESCE(t2.empname, 'No manager') [Manager]
FROM emp t1
LEFT OUTER JOIN
emp t2
ON
t1.mgrid = t2.empid

Copyright © 2009 - My Gadget Guru - is proudly powered by Blogger
Smashing Magazine - Design Disease - Blog and Web - Dilectio Blogger Template