Thursday, 4 November 2010

SharePoint: Customizing the Quick Launch menu

Customizing the Quick Launch menu to display several levels of data in a dynamic way and use this customized menu for quick access to all Views within a List without consuming space on the Quick Launch.
First, let’s add a List and make sure it shows on the Quick Launch. Let’s call this list “Navigation Test List”, and then add 4 Views to the list.
Next, let’s write some OM code that, when run, adds a link to each of the List’s Views under the List Link on the Quick Launch. Add the following code to a new C# Console Application in Visual Studio .NET or 2005 (and don’t forget to add a reference to Microsoft.Sharepoint.dll).
using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.SharePoint;
using Microsoft.SharePoint.Navigation;

namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
SPSite site = new SPSite("http://server");
SPWeb web = site.OpenWeb();
SPList list = web.Lists["Navigation Test List"];
SPNavigationNode rootListLink = web.Navigation.GetNodeByUrl(list.DefaultViewUrl);
SPNavigationNode node = null;
foreach (SPView view in list.Views)
{
node = new SPNavigationNode(view.Title, view.Url, false);
rootListLink.Children.AddAsFirst(node);
}
}
}
}

At this point, we have links to all of the Views under the List, but they cannot be displayed since the menu control ignores the links after the second level. So, let’s modify the menu control to display what we want. Perform the following to accomplish this task:

1. Navigate to the master page gallery: From the home page click on Site Actions, then Site Settings, and then on Master Pages, under the Galleries column
2. Click on the drop down menu for the master page you want to modify, and then click on Edit in Microsoft Office SharePoint Designer
3. Locate the Quick Launch Menu control, and modify the StaticDisplayLevels and MaximumDynamicDisplayLevels attributes:
id="QuickLaunchMenu"
DataSourceId="QuickLaunchSiteMap"
runat="server"
Orientation="Vertical"
StaticDisplayLevels="2"
ItemWrap="true"
MaximumDynamicDisplayLevels="1"
StaticSubMenuIndent="0"
SkipLinkText="">

4. Save your changes and reload the page from the browser. Hover over the Links on the Quick Launch. The end result should look like this:

5. Optional: Modify other properties in the menu control to match the look and feel of your site. The above steps can also be applied to the Top Link Bar.

ASP .net: css tips

Simply use the "!important" tag and the background color will be forced behind the arrow.

.ms-topNavFlyOutsHover
{
background-color:#FFCC00 !important;
color:#000000;
}

SharePoint: Actice Menu dropdown flyout

MOSS 2007 sites can display drop down menus in the tabbed navigation across the top. Unfortunately there is not an easy check box to activate this functionality, instead things just have to be set up the right way. If you want your MOSS site to show drop down menus, make sure the following is true or walk through the following steps:
From the root of the parent site (Home) choose to create a new site (Site 1). Once that site is created, you will be in that new site. From here choose to create a new page.
Once that is created, choose to create another new site (Sub Site 1). Then create a new page in Sub Site 1.
Your site structure should resemble this, see structure.
For each site in the Navigation settings, both Show Subsites and Show Pages should be checked.
Select Site Actions - Site Settings - Modify Navigation.
Check Show subsites and Show pages in the first row. See sample.
The end result would be a tab in the horizontal bar for Site 1, with a vertical drop showing Sub Site 1. See sample.
The navigation shows sub sites under the parent and published pages at the parent. Pages for one site are stored flat in a single library. If you want the navigation to show 2nd level sub site pages or 3rd level sub sites under the 2nd level, you need to make a very minor tweak to the master page that the site is using.
Using SharePoint Designer (SPD), open the master page being used by the site. Warning! Making edits to this file will customize the file, a.k.a. unghost it. Don't worry you can always undo this action.
In SPD, navigate to _catalogs/masterpage/*.master
How do you know which master the site is using? In the site, go to Site Actions - Site Settings - Modify All Settings, then choose Master page under the Look and Feel column. Check which master page is selected in each drop down.
In the master page file, search for SharePoint:AspMenu.
You will more than likely have more than one instance of a menu control. Look at the IDs to find the right navigation control for what you want to edit. They are intelligently named, you will be able to sort out which one you need. For default.master, look for ID="TopNavigationMenu".
In the properties for the tag, find MaximumDynamicDisplayLevels="1". Change the number from 1 to 2.
Save the file and publish the master page (do this from SPD, Manage Content and Structure, or the Master Page Gallery).
Refresh your browser. Now when you mouse over Site 1 - Sub Site 1, you should see another level of navigation pop up. See sample.
Cool, ehh? Please don't abuse this dynamic display level. As tempting as it is to provide instant access to something 5 levels deep in your site, drop down menus notoriously aggravate end users. I highly recommend using no more than 2 levels (what we set in this walk through).

SharePoint: Logging files

If the solution that redeploy report by SQL Server Business Intelligence Studio doesn’t work. May I have your system environment information?
1. Operating System Version
2. SQL Server Version
3. WSS 3.0 or SharePoint 2007 or Others

Generally, you may try steps below:
1. Check Reporting Service Status from Reporting Service Configuration
You may check Status of Reporting Service and confirm if it is integrated mode.

2. Check Settings of Report Server in SharePoint Central Administration
You may check if it has correct Report Server Web Service URL and Authentication Mode.

3. Check Authentication Provider for your Report Center Web Application from SharePoint Central Administration

4. Detail log of report server
You may find these logs from “C:\Program Files\Microsoft SQL Server\MSSQL.x\Reporting Services\LogFiles\”.

5. In OS Event Viewer, could you find out some Error information from Application log?

6. Detail SharePoint log
You may find these logs from “C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\LOGS\”.

SharePoint: Good examples

http://www.getsharepoint.com/ourwork/pages/ourwork.aspx

http://getsharepoint.com/SI/default.aspx

SharePoint: Increase upload max file size

Changing the maximum file upload size in SharePoint
The default file upload size in SharePoint is 50 MB. Sometimes, you may have users that need to upload documents that are larger. This is quite easy to change. Simply go to Central Administration -> Web Application General Settings. Select the Web Application you want to change, and you will see a textbox to specify the maximum upload size. Before I remembered to look here, I tried changing it the old ASP.NET way, by changing the following line in the web.config.

Interestingly, the file size specified here is also 50 MB, but changing it here does not allow you to upload a larger file into a document library. I also figured I might have to change it to match whatever I had set in SharePoint but you don't. You can leave it the same and upload a 100 MB file into SharePoint just fine (provided you changed the setting). So from what I can tell SharePoint does not use this setting at all and it would only apply if you had written a custom upload form using ASP.NET.

Friday, 29 October 2010

ASP .net: IIS Configure site name

Configure Web Sites by Using Host Header Names

To configure Web sites by using the Host Header Names feature, follow these steps:

  1. Click Start, point to Administrative Tools, and then click Internet Information Services.
  2. Expand * server name (where server name is the name of the server), and then expand Web Sites.

  3. Right-click the Web site that you want, and then click Properties.The Web site name Properties dialog box appears (where Web site name is the name of the Web site that you selected).

  4. Click the Web Site tab, and then in the IP Address list, select the IP address that you want assigned to this Web site.

  5. Click Advanced.

  6. Under Multiple identities for this Web Site, click the IP address, and then click Edit.The Advanced Web Site Identification dialog box appears.

  7. In the Host Header Name box, type the host header that you want. For example, type www.example1.com. Add the port number, select the IP address in the list, and then click OK.NOTE: If you want to configure this Web site with additional identities, click Add. Use the same IP address and TCP port, but enter a unique Host Header Name, and then click OK. For example, if you want to access the same Web site from both the Internet and a local intranet, you can configure the Web site identity in the manner shown in the following example:
    IP Address TCP Port Host Header Name
    192.168.0.100 80 www.example1.com
    192.168.0.100 80 example1.com

  8. In the Advanced Multiple Web Site Configuration dialog box, click OK.

  9. In the Web site name Properties dialog box, click OK.You return to the IIS window.

  10. Right-click the next Web site that you want, and then click Properties.

  11. In the IP Address list, select the same IP address that you selected in step 4, and then click Advanced.

SQL: Setting Up Data And Log Files For SQL Server

Setting Up Data And Log Files For SQL Server

When a database is created in SQL Server it creates two files by default: one is the data file with an extension of .mdf that stores the actual data, and the other is the log file with an extension of .ldf that stores the transaction log information used to recover data in disaster recovery scenarios. The mdf is the primary data file; in case of very large databases it might be useful to have secondary data files with an extension of .ndf in which case the data will be stored in both mdf as well as ndf files.
The placement of mdf, ndf and ldf files on a particular drive is a matter of decision based on the size requirements of each file, and more importantly on the impact it will have on the overall performance of the database. As the log file is write-intensive it should be placed on a separate drive and the data files also placed on separate drives of their own. Even secondary data files should be placed on a separate drives to optimize performance. Why? This is because, it increases parallelism while accessing the data and log files for read/write operations.
The log file is write-intensive, and the data file (depending on your application) is read/write intensive. Suppose you have multiple users simultaneously updating and requesting data. For data retrieval, the log file is not needed, and so the requests for data can be satisfied from the data file placed on its own drive. This would involve the movement of only the spindle of that drive on which the data file is kept. For data updates, the log file is heavily used, and so any write operations would involve the movement of the spindle of the drive on which the log file is placed. Now, if both log and data files are placed on the same drive, the amount of spindle movement would be heavy so as to satisfy both read and write operations. But, if you place the data and log files on separate disk drives, then the spindle movement for write operations won’t interfere with that of the read operations, since each drive’s spindle would be moving independently to satisfy read as well as write requests, thus improving the performance of data retrieval and data updates.

Ideally, the separation of data and log files on drives should be done while creating the database, but this can be done later also after the database is created and is in use. SQL Server is very flexible in that. The way to go about doing this is to use the two statements that SQL Server provides: CREATE DATABASE and ALTER DATABASE. Let’s look at both examples where database_name is the name of the database being created and/or altered, and os_path is the operating system file path.

While creating a database, you use the Create Database statement in the following manner:
CREATE DATABASE database_name ON
(NAME=Database_name_data,
FILENAME = ‘os_path\database_name_data.mdf’),
(NAME=Database_name_log,
FILENAME = ‘os_path\database_name_data.ldf’)


If you want to add secondary data files, the statement would be:
CREATE DATABASE database_name ON
(NAME=Database_name_data,
FILENAME = ‘os_path\database_name_data.mdf’),
(NAME=Database_name_data,
FILENAME = ‘os_path\database_name_data.ndf’),
(NAME=Database_name_log,
FILENAME = ‘os_path\database_name_data.ldf’)


If you already have a database and want to change the drive location of either the data or log file, then use the Alter Database statement in the following manner:

First, bring the database to an offline status by giving the following command:
ALTER DATABASE database_name SET OFFLINE

Next, change the location of either the data file or the log file with the following command for each file:
ALTER DATABASE database_name MODIFY FILE ( NAME = database_name_data, FILENAME = 'new_path\database_name_data.mdf' )ALTER DATABASE database_name MODIFY FILE ( NAME = database_name_data, FILENAME = 'new_path\database_name_data.ndf' )ALTER DATABASE database_name MODIFY FILE ( NAME = database_name_data, FILENAME = 'new_path\database_name_data.ldf' )
Finally, bring the database back online by issuing the following command(but before giving this command make sure you copy the data and log files to their new locations):
ALTER DATABASE database_name SET ONLINE


After this you should verify the changed locations of the files by querying the sys.master_files catalog view:

SELECT name, physical_name AS CurrentLocation, state_descFROM sys.master_files WHERE database_id = DB_ID(N'database_name');
The above procedure is valid for both SQL Server 2008 and 2005.

Wednesday, 27 October 2010

SharePoint: Fix issue with People scope returning empty

1. Go to User Profiles and props in Shared Service.
2. Select Start Full import *(make sure No of users is present).
3. Go to http://*mysite Address here*/_layouts/settings.aspx
4. Click Site Visability
5. Set the "Allow this web to appear in search results?" to true
6. check " Always index all ASPX pages on this site "
7. Then run the crawl again and thsi should work.

Wednesday, 13 October 2010

Sharepoint: Performance tuning

Common issues and resolutions:
http://technet.microsoft.com/en-us/magazine/2009.08.insidesharepoint.aspx

performance tips and tuning in configs:
http://sharepointbergen.blogspot.com/2007/07/sharepoint-2007-performance-and-tuning.html

Different caching parameters:

Enable the BlobCache in web.config to create a disk cache for all pictures, style sheets and scripts that are used => Reduced database traffic.
Consider reducing the number of application pools used to relase more memory on the server(s). Each application pool is assigned a unique worker process which again loads the runtime => More memory for caching the "real stuff" :-)
Set the correct Caching profile on each web site - from the Admin page => Quicker page loads.
Web parts and customizations

Write your web parts and custom controls and pages such that the do as little data processing as possible before the user makes an action. => Reduces the time to load a the page that are using your web part/component.
Site structure

Depth of the web site hierarchy => Content by Query and other querys will run quicker


And.....


Resolving Performance Issues
Regardless of the framework and methodology you use in trying to understand your SharePoint performance issues, isolate their root causes, and resolve the problems, you need baseline data that reflects acceptable performance against which you compare data that reflects poor performance. You can obtain a baseline set of performance data either right after your initial deployment, during periods of acceptable performance, or from best-practice recommendations. If you have no basis for comparison, then you can use Microsoft published performance recommendations for various measurements, available at technet.micro-soft.com/en-us/library/cc262787.aspx.
As I already mentioned, the most common performance issues happen as a result of interrelated components. This can be troublesome because the underlying indicators are often the same. For example, one common indicator of a performance issue is a spike in resource utilization, such as RAM, CPU, or disk I/O. To resolve the performance issue, you need to look at all available data, understand the sequence of events leading to the issue, and correlate events to determine the underlying root cause. Figure 2 shows common performance issues, possible root causes, and resolution options.
Figure 2 Issue, Cause and Resolution Summary
Issue Possible Root Causes Possible Resolutions Additional Resources
High disk I/O activity on SQL Server Large list operations, timer jobs, SQL maintenance tasks, backup, indexing, inadequate RAM, high I/O databases such as temp tlog, search, and content, placed on same disk or slow disks. Separate temp and search databases in multiple files across high I/O disk volumes, increase RAM, use dedicated disks for transaction logs, defragment, and re-index databases weekly. technet.microsoft.com/en-us/library/cc678870.aspx
msdn.microsoft.com/en-us/library/ms175527.aspx
technet.microsoft.com/en-us/library/cc263261.aspx
technet.microsoft.com/en-us/library/cc262067(TechNet.10).aspx
SQL blocking/locking NIC configuration, large list operations, indexing/crawling jobs. Do not use SharePoint Team Services Administration (STSADM). Use SQL backup, DPM, Litespeed, or SQL 2008 with compression, ensure fill factor is set to 70% on content databases, enforce 100GB growth limit. technet.microsoft.com/en-us/library/cc901593.aspx
go.microsoft.com/fwlink/?LinkID=105623&clcid=0x409
support.microsoft.com/kb/271509
support.microsoft.com/kb/298475
Overall slow page loads Compression not enabled. Caching not enabled or not configured. Large pages. Redundant SQL trips, underlying network issues. Enable caching and compression, check page load times, and examine SQL queries and round trips, check NIC for Broadcom 5708 Chimney issues. technet.microsoft.com/en-us/library/cc298550.aspx
support.microsoft.com/kb/942861
Long time to load full page Improper SharePoint object handling in custom code, slow links, SQL blocking, timer jobs, Web part caching not enabled. Resolve back-end bandwidth and response issues, dispose of objects properly, use 64-bit hardware or configure memory pool limits, delay downloading core.js. code.msdn.microsoft.com/SPDisposeCheck
technet.microsoft.com/en-us/library/cc298550.aspx
technet.microsoft.com/en-us/library/cc678870.aspx
technet.microsoft.com/en-us/library/cc298466.aspx
Poor list performance Large lists >2,000–3,000 items in a level. No indexing on lists. Underlying SQL Server issues. Too many columns. Index on one or more columns, ensure SQL Server performance, keep fewer than 2,000–3,000 items in a level. go.microsoft.com/fwlink/?LinkID=105580&clcid=0x409
Long crawl and index times or indexing causing sluggishness Large data volumes require long index times, no dedicated index target. Block with robots.txt, offload crawling/indexing to dedicated front-end server. technet.microsoft.com/en-us/library/cc261810.aspx
LDAP operations (such as authentication and user operations) causing usage spikes Low bandwidth, remote domain controller, large profile imports. Increase bandwidth, use Kerberos, optimize profile importing. support.microsoft.com/kb/827754
Backup taking too long Using STSADM, other SQL conditions such as blocking. Use Microsoft Data Protection Manager (DPM) or SQL 2008 with compression. technet.microsoft.com/en-us/library/cc901593.aspx
IIS out of memory conditions Application pool and worker process recycling, improper object handling, not enough RAM, poor load balancing architecture. Use IIS overlapped recycling, use 64-bit hardware. msdn.microsoft.com/en-us/library/aa720391(VS.71).aspx
technet.microsoft.com/en-us/library/cc737679.aspx
As you narrow down possible causes for performance issues, keep in mind general operations best practices, such as the ones documented in the IT Showcase white paper, "SharePoint Performance Optimization." Applying the latest patches, service packs, and updates for SQL Server, IIS, SharePoint, and Windows Server is especially important. Microsoft has fixed many previous performance issues, such as tempdb allocation contention (see Concurrency enhancements for the tempdb database) and TokenAndPermUserStore cache (see Queries take a longer time to finish running when the size of the TokenAndPermUserStore cache grows in SQL Server 2005).

Troubleshooting Tools
You can rely on a diverse range of tools for digging down to the specifics of a SharePoint performance issue and gathering evidence that would help you make a diagnosis, determine the root causes, and resolve the problem.
The following tools are especially helpful in pinpointing causes of performance issues:
Fiddler PowerToy and neXpert add-on Used together, these tools provide a solid starting point for page load analysis. They allow you to review caching, compression, and overall HTTP performance. You can get more information about these tools at Fiddler PowerToy - Part 2: HTTP Performance and Microsoft neXpert Performance Analysis Plugin.
WireShark When you need to look into network issues, use WireShark. It works with many media, and you can capture packets from recreated TCP/IP conversations when you recreate issues. For more information, see wireshark.org.
Visual RoundTrip Analyzer (VRTA) You can use VRTA to examine the round-trip performance from request to response. VRTA examines the communications protocol, identifying the causes of excessive round trips, and recommending solutions. You can download it from Microsoft downloads, Visual Round Trip Analyzer.
SQL Profiler You can use this useful tool, installed with SQL Server, for monitoring an instance of SQL Server Database Engine or SQL Server Analysis Services. It enables you to discover issues with queries, deadlocks, timeouts, recompilations, and general errors and exceptions.
SQLDiag This tool, also installed with SQL Server, collects valuable information about the configuration of the computer running SQL Server, the operating system, and the information that is reported to the SQL Server error logs.
SQL Query Analyzer This is a low-level debug tool for analyzing query performance issues. It also is part of the SQL Server toolset.
SPtraceview This is one of my favorite tools because it provides a view of performance issues in real time. It's useful for monitoring diagnostic tracing when working with custom Web parts. For more information, see SPTraceView – Lightweight Tool for Monitoring the SharePoint Diagnostic Logging in Real-Time.
WSSDW.exe This is a performance-testing tool that populates data for testing deployments of Office SharePoint Server 2007. See Tools for performance and capacity planning (Office SharePoint Server) and SharePoint 2007 Test Data Population Tool for more information.
Custom tool for client-based URL ping This is one of the most useful tools because it enables the comparison of statistics before and after implementing configuration changes to the environment. See the appendix on the SharePoint Performance Optimization page.

Constant Monitoring
SharePoint performance tuning, like most things SharePoint, is complex. You need to understand the object model, details about the SharePoint architecture, and the interactions between IIS/.NET and SQL Server. You also need to know database administration and troubleshooting best practices. The good news is that if you lack this understanding, you can still do well at optimizing your SharePoint infrastructure by following established best practices, recommendations, and knowledge, and addressing the common issues pointed out here.

SharePoint: Uninstalling Considerations

Uninstalling sharepoint considerations:

http://nehasinha.wordpress.com/2008/02/01/uninstalling-moss-2007-manually/

Note: Before performing these operations make sure you backup all Share Point databases and create a backup of the registry.

a) Disable and Stop the following services

-Microsoft Single Sign-on Service
-Office SharePoint Server Search
-Windows SharePoint Services Administration
-Windows SharePoint Services Search
-Windows SharePoint Services Timer
-Windows SharePoint Services Tracing
-Windows SharePoint Services VSS Writer

b) Note the following registry keys:

From HKLM\Software\Microsoft\Office Server\12.0
-Install Path (default is C:\Program Files\Microsoft Office Servers\12)

From HKLM\Software\Microsoft\Shared Tools\
Web Server Extensions\12.0
-Location (default is C:\Program Files\Common Files\Microsoft Shared
\Web Server Extensions\12)

c) Delete the following registry hives:

HKLM\Software\Microsoft\Office Server\12.0
HKLM\Software\Microsoft\Shared Tools
\Web Server Extensions\12.0

[x32] – HKLM\Software\Microsoft\Windows
\CurrentVersion\Uninstall\OSERVER
[x64] – HKLM\SOFTWARE\Wow6432Node\Microsoft
\Windows\CurrentVersion\Uninstall\OSERVER

d) Delete the following folders:
The value of the InstallPath key
The value of the Location key
C:\%CommonProgramFiles%\Microsoft Shared\SERVER12
Restart the server and perform an installation as normal.
Before running the configuration wizard, follow the steps as follows
You need to restore the Server Language registry value by
creating the following .reg file (open notepad and paste the following):

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft
\Shared Tools\Web Server Extensions\12.0 \ServerLanguage]
“1033″=”"

Sharepoint: Best practices

1. Remove spaces from site name as removes %20, etc
2. Try to keep pictures in root picture library and use path
e.g. http://portal/sysimages/email.jpg
better: /sysimages/email.jpg
3. Make sure SharePoint site added to trusted IE intranet
4. In columns don't use £@, etc use no, etc
5. Create subsite each time new information is present

SharePoint: webparts

CorasWorks Cross Site Search
http://mindsharpblogs.com/todd/archive/2005/02/14/293.html

Additiional free webparts:
http://blog.brainlitter.com/sharepoint/Lists/BestPractices/AllItems.aspx

SharePoint: Q and A

• What is SharePoint?
Portal Collaboration Software.

• What is the difference between SharePoint Portal Server and Windows SharePoint Services?
SharePoint Portal Server is the global portal offering features like global navigation and searching. Windows SharePoint Services is more content management based with document libraries and lists. You apply information to certain areas within your portal from Windows SharePoint Services or directly to portal areas.

• What is a web part zone?
Web part zones are what your web parts reside in and help categorize your web parts when designing a page.

• How is security managed in SharePoint?
Security can be handled at the machine, domain, or sharepoint level.

• How are web parts developed?
Web parts are developed in Visual Studio .Net. VS.Net offers many web part and page templates and can also be downloaded from the Microsoft site.
• What is a SharePoint farm?
Multiple machines running services for SharePoint. Otherwise known as Topology.

• What is a site definition?
It’s a methods for providing prepackaged site and list content.

• What is a template?
A template is a pre-defined set of functions or settings that can be used over time. There are many templates within SharePoint, Site Templates, Document Templates, Document Library and List Templates.

• How do you install web parts?
Web Parts should be distributed as a .CAB (cabinet) file using the MSI Installer.

• What is the difference between a site and a web?
The pages in a Web site generally cover one or more topics and are interconnected through hyperlinks. Most Web sites have a home page as their starting point. While a Web is simply a blank site with SharePoint functionality built in; meaning you have to create the site from the ground up.

• What are the differences between web part page gallery, site gallery, virtual server gallery and online gallery?
Web Part Page Gallery is the default gallery that comes installed with SharePoint. Site Gallery is specific to one site. Virtual Server gallery is specific to that virtual server and online gallery are downloadable web parts from Microsoft.

• What is the GAC?
Global Assembly Cache folder on the server hosting SharePoint. You place your assemblies there for web parts and services.

• What is a DWP?
The file extension of a web part.

• What is CAML?
Stands for Collaborative Application Markup Language and is an XML-based language that is used in Microsoft Windows SharePoint Services to define sites and lists, including, for example, fields, views, or forms, but CAML is also used to define tables in the Windows SharePoint Services database during site provisioning.

• What is a document library?
A document library is where you upload your core documents. They consist of a row and column view with links to the documents. When the document is updated so is the link on your site. You can also track metadata on your documents. Metadata would consist of document properties.

• What is a meeting workspace?
A meeting workspace is a place to store information, attendees, and tasks related to a specific meeting.

• What is a document workspace?
Document workspaces consist of information surrounding a single or multiple documents.

• What is a web part?
Web parts consist of xml queries to full SharePoint lists or document libraries. You can also develop your own web parts and web part pages.

• What is the difference between a document library and a form library?
Document libraries consist of your core documents. An example would be a word document, excel, powerpoint, visio, pdf, etc… Form libraries consist of XML forms.

• What are themes?
Themes provide a quick a easy way to change the appearance of your SharePoint site
.
• What is presence?
Allows users to see if other users are online and can send them instant messages.

• Can web parts be connected? if so, how?
Web Parts can be connected by Modifying the Shared Part and providing the connection with the correct fields to share.

• What is a personal view and what is a shared view?
Personal views are specific to a user while Shared View is common across all users.

• What is an STP file?
The file extension that applies to site templates.

• What is an FWP file?
The file extension that applies to SharePoint sites that have been backed up.

• How does SharePoint support MS Outlook integration?
Via Web Parts available at the Microsoft Web Component Directory. Oh yeah and Active X Controls.

• How can you extend lists in SharePoint?
If you mean extend by adding columns of data and have specific data types for each column the answer is yes. You can also use Data Views in FrontPage 2003 to pull in XML data from other sites, lists or document libraries to make the information more presentable for users.

• Explain the document versioning in SharePoint document libraries
When versioning is enabled everytime the document is edited from the SharePoint site it creates a new version. You can restore or delete old versions of documents. Version numbers are incremented by the system itself.

• Where are web part resources contained?
The SharePoint file system, SQL, and the GAC folder. They are also referenced in the web.config folder.

• What are the different installation methods for deploying web parts? and what are the pros/cons?
The best way is via a CAB file using the MSI Installer.

• What is a ghosted/unghosted page?
Page that is created from a template oppsed to being created from scratch.

• How is site data stored?
Site data is stored in your content database that either resides in SQL Server 2000 or MSDE.

• Where is metadata for a web stored?
In the content databases stored in SQL.

• What is an audience and describe the use?
Audiences are a pre-defined set of users that you can apply information to. You can apply information to their personal sites as well for dailey information or job tasks.

• What are the trust levels and what is the default trust associated with SharePoint?
SSL and the basic IIS security. SharePoint comes with Integrated Windows Authentication turned on.

• What are the two logging mechanisms for usage statistics?
By default creates log files in the \%windir%\system32\LogFiles\STS directory on the front-end Web server, although an alternate location can be specified. The STS directory contains a folder for each virtual server on the Web server, each named with a GUID that identifies the respective virtual server. Each virtual server folder contains subfolders for each day, which in turn contain the daily usage log for each virtual server. In addition to containing information per virtual server, the Windows SharePoint Services logs are also useful because they associate users with page hits and with time stamps. what functionality does owssup.dll provide for client side activities?

• What is STSAdm and what can it be used for?
STSADMIN is a tool that can do many things from a command prompt like manage users, create new sites and add files to the file system.

• Can WSS search subsites?
Not without the new CorasWorks Search Web Part.

• Can you register alerts for users?
Not unless you are logged in as that user.

• Are PDFs searchable?
Out of the box only the metadata collected in the upload form is search able. Unless you download and install the Adobe iFilter.

• Describe a large deployment
Many front-end webserver with a SQL cluster with the possibility of multiple international locations.

• How can you synchronize custom Active Directory attributes to SharePoint?
Via the Profile Importer.

• If it is anticipated that our organization would need to store 1 terrabyte of documents, what is the recommended configuration and storage requirement?
Multiple front-end web servers with content databases across the server farm. The amount of web-servers can depend on how many users you have and what the typical size of a document is.

• Explain how you would deploy SharePoint on an extranet
Usually servers that are accessible from external sources are housed in DMZ’s. Depending on the requirements and the workflow for publishing content you could go with Multiple Servers hosting the same information. One server would reside inside with the SQL Cluster while the external server resides in the DMZ simply calling data. Security would be handled by the same or different active directory domain clusters as well increasing security.

• What is the BKM for maximum number of virtual servers configured for SharePoint on a single box?
I believe its 15.

• what are the migration strategies for moving sites around?
You could use the SharePoint Portal Server backup and restore tool as well as the STSADMIN and GUI STSAMIN tools. We have migrated databased from the SQL Level and have simply reconnected the front end.

SharePoint: Installation Guides

Single machine instance:
http://blogs.msdn.com/b/martinkearn/archive/2007/03/28/how-to-install-sharepoint-server-2007-on-a-single-machine.aspx

Step by step installation guide:
http://www.codeproject.com/KB/sharepoint/SharePoint_Server_2010.aspx
*http://mindsharpblogs.com/bill/archive/2006/06/27/1153.html

SharePoint: Design considerations


Tuesday, 21 September 2010

ASP .net: Server requests

Windows user:
Request.ServerVariables["AUTH_USER"].ToString()

Current year
<%=HttpContext.Current.Timestamp.Year%>

Thursday, 9 September 2010

MDX: Last nonempty

Last non empty

LastNonEmpty is an aggregation function available in the Enterprise version of SQL Server. However, you can create your own with a little bit of recursive MDX. Essentially, you simply create a calculated member that returns the non empty value, or if empty, it looks in the previous member. It really is very simple, and is an elegant way of writing a last non empty query. To create a LastNonEmpty calculate measure, simple use MDX such as the following


With Member Measures.LastHits as
iif(isempty(Measures.Hits),
([Date].[Year Month Day].prevmember,
Measures.LastHits
),Measures.Hits)



Notice how the calculated member is called LastHits, and the calculation actually refers to LastHits. This is the recursion. It keeps referring back to itself until it gets a day with a non empty value. If there are no non empty values, the recursion will automatically stop at the first day in your dimension and return null.


Naturally, you can add other calculations on top of this recursive calculation. For example, you might want to sum up the month to date figures using this non empty calculation. No problem, here is a MTD calculation using the last non empty calculation above.

With Member Measures.LastHits as
iif(isempty(Measures.Hits),
([Date].[Year Month Day].prevmember,
Measures.LastHits
),Measures.Hits)
Member Measures.LastHitsMTD as
sum(PeriodsToDate([Date].[Year Month Day].[Month],[Date].[Year Month Day]),Measures.LastHits)
select
{Measures.Hits,Measures.LastHits,Measures.LastHitsMTD}
on Columns,
tail([Date].[Year Month Day].[Day],31)
on rows
from
EasternMining

ASP: How to Debug websites

How to Debug websites

SQL: Profiler and Indexes

How to use SQL Profiler

Improve performance using Indexes

SSIS: Kimbell and SSIS performance

Kimball

SSIS performance tuning

SQL: optimisation and Fill Factor

Facts About the Fill Factor: http://www.devx.com/gethelpon/Article/10016/0/page/3

SQL Server optimisation: http://www.mssqlcity.com/Tips/tipSrvSet.htm

SQL Server Settings Optimization Tips
*****


You can increase the 'min memory per query' option to improve the performance of queries that use hashing or sorting operations, if your SQL Server has a lot of memory available and there are many queries running concurrently on the server.
The SQL Server will automatically allocate, at a minimum, the amount of memory set in this configuration setting. The default 'min memory per query' option is equal to 1024 Kb.


*****


You can increase the 'max async IO' option if your SQL Server works on a high performance server with high-speed intelligent disk subsystem (such as hardware-based RAID with more than 10 disks).
This option specifies the maximum number of outstanding asynchronous disk I/O requests that the entire server can issue against a file. By the way, the 'max async IO' SQL Server option is no longer supported in SQL Server 2000.


*****


You can change the 'network packet size' option to the appropriate value.
This option can improve performance on networks whose base topology supports larger packets than TCP/IP's default of 4096 bytes. For example, if client sends or receives large amounts of data, a larger packet size can improve performance, because it results in fewer network reads and writes. The default value for the 'network packet size' option is 4096 bytes. Microsoft does not recommend changing this option, because for most applications, the default packet size of 4096 bytes is best.


*****


You can change the 'fill factor' option to the appropriate value.
The 'fill factor' option specifies how full SQL Server will make each index page. When there is no free space to insert new row on the index page, SQL Server will create new index page and transfer some rows from the previous page to the new one. This operation is called page splits. You can reduce the number of page splits by setting the appropriate fill factor option to reserve free space on each index page. The fill factor is a value from 1 through 100 that specifies the percentage of the index page to be left empty. The default value for fill factor is 0. It is treated similarly to a fill factor value of 100, the difference in that SQL Server leaves some space within the upper level of the index tree for FILLFACTOR = 0. The fill factor percentage is used only at the time the index is created. If the table contains read-only data (or data that very rarely changed), you can set the 'fill factor' option to 100. When the table's data modified very often, you can decrease the 'fill factor' option to 70 percent, for example.


*****


You can increase the 'recovery interval' value.
The 'recovery interval' option specifies the maximum number of minutes per database that SQL Server needs to complete its recovery procedures. The default value of this option is 0. It means that SQL Server will automatically configure this option. SQL Server issues a checkpoint using the 'recovery interval' option. Microsoft does not recommend changing this option in general case, but sometimes you can improve performance by changing this option. You can monitor disk-write activity on the data files, and if you see periodic spikes that send disk utilization to 100 percent, you can increase the recovery interval. In this case, Microsoft suggests setting the 'recovery interval' option to 5 and continuing monitoring.


*****


You can set the 'priority boost' SQL Server options to 1.
You can set this option to 1, if you want from SQL Server to work with a higher priority than other processes on the same computer. The default value is 0. Setting 'priority boost' to 1 can degrade the performance of other applications running on the same computer with SQL Server. So, you should set the 'priority boost' SQL Server options to 1 only if you have dedicated server to SQL Server. In other case, do not change this option.


*****


Set the 'max worker threads' options to the maximum number of the user connections to your SQL Server box.
The default setting for the 'max worker threads' option is 255. If the number of user connections will be less than the 'max worker threads' value, a separate operating system thread will be created for each client connection, but if the number of user connections will exceed this value the thread pooling will be used. For example, if the maximum number of the user connections to your SQL Server box is equal to 50, you can set the 'max worker threads' options to 50, this frees up resources for SQL Server to use elsewhere. If the maximum number of the user connections to your SQL Server box is equal to 500, you can set the 'max worker threads' options to 500, this can improve SQL Server performance because thread pooling will not be used.


*****


You can specify the 'min server memory' and 'max server memory' options.
These options can be used to specify the fixed amount of memory to allocate to SQL Server. In this case, you should set the 'min server memory' and 'max server memory' to the same value (equal to the maximum amount of physical memory that SQL Server will use), and set the 'set working set size' SQL Server option to 1. This can improve performance because SQL Server will not dynamically allocate memory. You can also change these options when SQL Server works on the same computer with other applications. In this case, the 'min server memory' options is used to allow SQL Server works when other applications pretend to use all available memory, and the 'max server memory' options is used to allow other applications work when SQL Server tried to use all available resources.


*****


You can specify the 'set working set size' SQL Server option to reserve the amount of physical memory space for SQL Server.
Unlike SQL Server 6.5, SQL Server 7.0/2000 can automatically allocate memory (can take more memory if SQL Server need it, and can give memory back to operation system). This is one of the main advantages in comparison with previous versions, but dynamic memory allocation takes some time. If you know the maximum amount of physical memory that SQL Server will use, you can specify this amount by setting 'min server memory' and 'max server memory' to the same value (equal to the maximum amount of physical memory that SQL Server will use) and set the 'set working set size' option to 1.

Wednesday, 8 September 2010

Tuesday, 25 May 2010

ASP .NET: recall page through gridview selection



using System;

using System.Collections.Generic;

using System.Linq;

using System.Web;

using System.Web.UI;

using System.Web.UI.WebControls;



public partial class Help_Filter : System.Web.UI.Page

{

    protected void Page_Load(object sender, EventArgs e)

    {



        if (Request.QueryString["FilterValue"] == null)

            Session.Remove("FilterValue");

        else

            Session["FilterValue"] = Request.QueryString["FilterValue"];



        if (Session["FilterValue"] != null)

        {

            string test = Session["FilterValue"].ToString();

            string strscript = "<script language=javascript> parent.parent.GB_hide(); </script>";

            //if (window.opener && !window.opener.closed) { window.opener.location.reload(); } </script>";

            //window.top.close();

            if (!ClientScript.IsStartupScriptRegistered("clientScript"))

                ClientScript.RegisterStartupScript(Page.GetType(), "clientScript", strscript);





        }

    }



    protected void GridView1_SelectedIndexChanged(object sender, EventArgs e)

    {

        GridView d = (GridView)sender;



        string valueSelected = d.SelectedRow.Cells[0].Text;

        Session["FilterValue"] = valueSelected;

        string strscript = "<script language=javascript> parent.parent.GB_hide(); </script>";

        //if (window.opener && !window.opener.closed) { window.opener.location.reload(); } </script>";

        //window.top.close();

        if (!ClientScript.IsStartupScriptRegistered("clientScript"))

            ClientScript.RegisterStartupScript(Page.GetType(), "clientScript", strscript);

    }



    protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)

    {



        if (e.Row.RowType == DataControlRowType.DataRow)

        {

            e.Row.Attributes.Add("onmouseover", "this.style.backgroundColor='#ceedfc'");

            e.Row.Attributes.Add("onmouseout", "this.style.backgroundColor=''");

            e.Row.Attributes.Add("style", "cursor:pointer;");

            e.Row.Attributes.Add("onclick", "location='PreviousFilter.aspx?FilterValue=" + e.Row.Cells[0].Text + "'");

        }

    }

}


ASP .Net: Greybox close and refresh parent

There are several steps to this process.

1. Create function in Master page to create new window reload


<script type="text/javascript">

        GB_myShow = function(caption, url, height, width, is_reload_on_close) {

            var options = {

                caption: caption,

                height: height || 500,

                width: width || 500,

                fullscreen: false,

                overlay_click_close: true,

                show_loading: true,

                reload_on_close: is_reload_on_close || false,

                center_win: true

            }

            

        win = new GB_Window(options);

        

            return win.show(url);

        }

    </script>




2. Call class


<a href="Help/PreviousFilter.aspx" onclick="return GB_myShow('Previous Filters', this.href, 330,500, true)" style="color:Blue;"><img src="graphics/Search.png" height="16px" title="Previous Filters" alt="#" /></a>



3. Close parent window
parent.parent.GB_hide();


parent.parent.GB_hide();

<div class="viewcode">

   string test = Session["FilterValue"].ToString();

            string strscrip

Publish Post

t = "<script language=javascript> parent.parent.GB_hide(); </script>";

            //if (window.opener && !window.opener.closed) { window.opener.location.reload(); } </script>";

            //window.top.close();

            if (!ClientScript.IsStartupScriptRegistered("clientScript"))

                ClientScript.RegisterStartupScript(Page.GetType(), "clientScript", strscript);

</div>




Friday, 21 May 2010

SQL: Alter schema of table

To alter schema:

Alter Schema NewSchema Transfer dbo.tablename

Friday, 5 March 2010

Website: Get noticed in google search engine

Check out: http://www.vodahost.com/vodatalk/google/11694-google-search-does-not-show-my-page.html


Step 1: check can be viewed in googlebot by using Lynx viewer
http://www.yellowpipe.com/yis/tools/lynx/lynx_viewer.php

Step 2: look at google's webmaster guidelines:
http://www.google.com/support/webmasters/bin/answer.py?answer=35769

Step 3: Give your page title something like "Microsoft Business Intelligence Consultant John Ilett"
Right-click on your BV page (away from any element or object), and you will see Page Properties > Click > Page Properties Dialog Box...

Step 4: General tips
It needn't be so, however, and at VodaHost, we believe you will find no easier means to apply this technical expertise to your website designs as an effective element to your online success with the tools, technologies, and peer support so freely available!You need to "search" the various Forums here in VodaTalk to read up on various means to "optimize" you design to be 'friendly' to the Search Engines, as there are foundational methods and forms you need to consider.You can start in the "Search Engine Topics & VodaHits" Forum, and move to others like "General Support" where you can actually perform a "Search Forum" based on key words to bring up relevant topics as you glean information. (To "Search Forum" you will find this available in the blue header of the VodaHost "VodaTalk Forum" itself)Also, don't neglect the "KeyWord Digger" Tutorial already prepared for your use by VodaHost, which can visually tie together some of the new terms and principles for you whilst offering specific instructions on how to complete the task itself!To begin, actually right-click on a blank area of your page in Blue Voda, and then select PAGE PROPERTIES....tabbed, you will now see some of the various information you should carefully construct that is extremely important to how your Page is actually "recognized" and "cached" by the no-nonsense Search Engines....now you can understand the relevance of the mentioned principles, and have the means to investigate and learn them yourself!**When you have neared completion of your website, you should consider enrolling in the extremely affordable and very effective VodaHits SEO program. There is no better value for this critical service on the web!


More...
Search 1: andysbodyseBay Member Profile for andysbodysMember Profile : andysbodys ( 519 ) ... 627 feedback received by andysbodys ( 0 ratings mutually withdrawn ), Page 1 of 26 ...feedback.ebay.com/ws/eBayISAPI.dll?ViewFeedback&userid=andysbodys - 79k - Supplemental Result - Cached - Similar pagesSearch 2: andysbodiesDid you mean: andy's bodies Andy's Auto Sport - Body Kits and Carbon Fiber Hoods Superstore!You really need to see you are putting a space where it should never go.You have saved your pages as : http://andysbodies.net/You left out the www. part, first of all.....AND1. Your CONTACT US link lists the link "andys bodys.net/contact" See the space?? Use an underscore, if you need to between page titles, but you do NOT have a space in your registered domain, do you? > Nor should you anywhere else!2. You have not named/titled your pages, so there is no association for them to "Go" or even be "Found"

Wednesday, 3 March 2010

SQL: Performance tuning guide

http://www.sql-server-performance.com/tips/all_main.aspx

1. Query optimisation can be achieved using the Query optimiser on most common queries. Will determine best indexes to build.

INDEXES
2. ALL table should have a CLUSTERED INDEX - this is an index on PK which is increasining (only 1 per table).
3. Index should be considered on any column in WHERE, ORDER BY, GROUP BY, TOP and DISTINCT experssions. (may be optmial for one query but not for other).
4. Setting different settings on index can affect performance. Clustered, non clustered, and composite indexes as well as setting FILLFACTOR and PAD_INDEX.
5. Static tables (dont change frequently) set FILL and Pad_index to 100 and can be heavily indexed as update/insert/delete not a problem.
6. Drop indexes not used by the Query optimiser.

INDEXED VIEWS
1. Create indexed view. Must set up the following:
SET ANSI_NULLS ON
SET ANSI_PADDING ON
SET ANSI_WARNINGS ON
SET CONCAT_NULL_YIELDS_NULL ON
SET NUMERIC_ROUNDABORT OFF
SET QUOTED_IDENTIFIER ON
SET ARITHABORT ON
2.
CREATE VIEW Vdiscount1 WITH SCHEMABINDING AS
SELECT SUM(UnitPrice*OrderQty) AS SumPrice, SUM(UnitPrice*OrderQty*(1.00-UnitPriceDiscount)) AS SumDiscountPrice, COUNT_BIG(*) AS Count, ProductIDFROM Sales.SalesOrderDetail GROUP BY ProductID
GO
CREATE UNIQUE CLUSTERED INDEX VDiscountInd ON Vdiscount1 (ProductID,colb,..)

3. When to use indexed view:
Data marts, data warehouses, decision support, data mining, OLAP applications.
Views that join two or more large tables.
Views that aggregate data.
Repeated patterns of queries.

Triggers
1. 2 triggers(Instead and After).
If likely only a few rolebacks then use instead otherwise after as overhead is less.
2. When ordering first trigger set it to the most likely rollback trigger so doesn't have to rollback all triggers throughout.
3. Run Query anaylizer to see performance of trigger on system.

Check Constraint
1. Faster than trigger for referential integrity

Use SP for client calls
1. As SP reduce network traffic because SQL in SP and not over network.
2. More secure
3. Better logic.

**Turn off nocount
1. Everytime SP is run returns rowcount to client. This is rarely useful
2. Switch off either putting this is each sp:
SET NOCOUNT ON
or switch off:
SP_CONFIGURE 'user options', 512RECONFIGURE

Check running latest version:
SELECT @@Version

Database tuning Advisor
1. Run profiler to pick up all current queries. (SQL:BatchCompleted and the RPC:Completed)
2. Then save trace and point DB tuning advisor to it.

SSRS 2008: Column Header remain visible

Need to create a second group on dynamic group the same.
1. Then go to Report > Grouping.
2. In the groups (bottom of report) select the arrow in the top right hand corner and select advanced mode.
3. Click the top group and go to properties.
4. Set the FixedData to true.
5. Set Row Visibility of group below to hiden.

You're done!

Thursday, 25 February 2010

Publish code on site

http://newbloggingtipz.blogspot.com/2009/08/how-to-add-html-codes-in-blogger-posts.html

Step 1: Add this


<div class="codeview"> </div>




Step 2: Get code and convert using simple code.
http://www.simplebits.com/cgi-bin/simplecode.pl


Step 3: Publish

Thursday, 7 January 2010

SQL: Add Country table and insert Countries

--STEP 1: Create Country table
CREATE TABLE [dbo].[tbl_Countries](
[Country_id] [int] IDENTITY(1,1) NOT NULL,
[Country_name] [nvarchar](100) NULL,
[Country_ShortName] [nvarchar](20) NULL,
[Sort_order] [int] NULL,
[Active] [bit] NULL,
CONSTRAINT [PK_tbl_country] PRIMARY KEY CLUSTERED
(
[Country_id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[tbl_Countries] ADD CONSTRAINT [DF_tbl_country_Active] DEFAULT ((1)) FOR [Active]
GO
--STEP 2: SET IDENTITY INSERT ON
SET IDENTITY_INSERT dbo.tbl_countries ON
--STEP 3: Insert all Countries (ID and Name)
INSERT INTO dbo.tbl_countries (Country_id,Country_name) VALUES (2, 'Afghanistan');
INSERT INTO dbo.tbl_countries (Country_id,Country_name) VALUES (3, 'Albania');
INSERT INTO dbo.tbl_countries (Country_id,Country_name) VALUES (4, 'Algeria');
INSERT INTO dbo.tbl_countries (Country_id,Country_name) VALUES (5, 'American Samoa');
INSERT INTO dbo.tbl_countries (Country_id,Country_name) VALUES (6, 'Andorra');
INSERT INTO dbo.tbl_countries (Country_id,Country_name) VALUES (7, 'Angola');
INSERT INTO dbo.tbl_countries (Country_id,Country_name) VALUES (8, 'Anguilla');
INSERT INTO dbo.tbl_countries (Country_id,Country_name) VALUES (9, 'Antarctica');
INSERT INTO dbo.tbl_countries (Country_id,Country_name) VALUES (10, 'Antigua and Barbuda');
INSERT INTO dbo.tbl_countries (Country_id,Country_name) VALUES (11, 'Argentina');
INSERT INTO dbo.tbl_countries (Country_id,Country_name) VALUES (12, 'Armenia');
INSERT INTO dbo.tbl_countries (Country_id,Country_name) VALUES (13, 'Aruba');
INSERT INTO dbo.tbl_countries (Country_id,Country_name) VALUES (14, 'Australia');
INSERT INTO dbo.tbl_countries (Country_id,Country_name) VALUES (15, 'Austria');
INSERT INTO dbo.tbl_countries (Country_id,Country_name) VALUES (16, 'Azerbaijan');
INSERT INTO dbo.tbl_countries (Country_id,Country_name) VALUES (17, 'Bahamas');
INSERT INTO dbo.tbl_countries (Country_id,Country_name) VALUES (18, 'Bahrain');
INSERT INTO dbo.tbl_countries (Country_id,Country_name) VALUES (19, 'Bangladesh');
INSERT INTO dbo.tbl_countries (Country_id,Country_name) VALUES (20, 'Barbados');
INSERT INTO dbo.tbl_countries (Country_id,Country_name) VALUES (21, 'Belarus');
INSERT INTO dbo.tbl_countries (Country_id,Country_name) VALUES (22, 'Belgium');
INSERT INTO dbo.tbl_countries (Country_id,Country_name) VALUES (23, 'Belize');
INSERT INTO dbo.tbl_countries (Country_id,Country_name) VALUES (24, 'Benin');
INSERT INTO dbo.tbl_countries (Country_id,Country_name) VALUES (25, 'Bermuda');
INSERT INTO dbo.tbl_countries (Country_id,Country_name) VALUES (26, 'Bhutan');
INSERT INTO dbo.tbl_countries (Country_id,Country_name) VALUES (27, 'Bolivia');
INSERT INTO dbo.tbl_countries (Country_id,Country_name) VALUES (28, 'Bosnia and Herzegovina');
INSERT INTO dbo.tbl_countries (Country_id,Country_name) VALUES (29, 'Botswana');
INSERT INTO dbo.tbl_countries (Country_id,Country_name) VALUES (30, 'Bouvet Island');
INSERT INTO dbo.tbl_countries (Country_id,Country_name) VALUES (31, 'Brazil');
INSERT INTO dbo.tbl_countries (Country_id,Country_name) VALUES (32, 'British Indian Ocean territory');
INSERT INTO dbo.tbl_countries (Country_id,Country_name) VALUES (33, 'Brunei Darussalam');
INSERT INTO dbo.tbl_countries (Country_id,Country_name) VALUES (34, 'Bulgaria');
INSERT INTO dbo.tbl_countries (Country_id,Country_name) VALUES (35, 'Burkina Faso');
INSERT INTO dbo.tbl_countries (Country_id,Country_name) VALUES (36, 'Burundi');
INSERT INTO dbo.tbl_countries (Country_id,Country_name) VALUES (37, 'Cambodia');
INSERT INTO dbo.tbl_countries (Country_id,Country_name) VALUES (38, 'Cameroon');
INSERT INTO dbo.tbl_countries (Country_id,Country_name) VALUES (39, 'Canada');
INSERT INTO dbo.tbl_countries (Country_id,Country_name) VALUES (40, 'Cape Verde');
INSERT INTO dbo.tbl_countries (Country_id,Country_name) VALUES (41, 'Cayman Islands');
INSERT INTO dbo.tbl_countries (Country_id,Country_name) VALUES (42, 'Central African Republic');
INSERT INTO dbo.tbl_countries (Country_id,Country_name) VALUES (43, 'Chad');
INSERT INTO dbo.tbl_countries (Country_id,Country_name) VALUES (44, 'Chile');
INSERT INTO dbo.tbl_countries (Country_id,Country_name) VALUES (45, 'China');
INSERT INTO dbo.tbl_countries (Country_id,Country_name) VALUES (46, 'Christmas Island');
INSERT INTO dbo.tbl_countries (Country_id,Country_name) VALUES (47, 'Cocos (Keeling) Islands');
INSERT INTO dbo.tbl_countries (Country_id,Country_name) VALUES (48, 'Colombia');
INSERT INTO dbo.tbl_countries (Country_id,Country_name) VALUES (49, 'Comoros');
INSERT INTO dbo.tbl_countries (Country_id,Country_name) VALUES (50, 'Congo');
INSERT INTO dbo.tbl_countries (Country_id,Country_name) VALUES (51, 'Congo');
INSERT INTO dbo.tbl_countries (Country_id,Country_name) VALUES (52, ' Democratic Republic');
INSERT INTO dbo.tbl_countries (Country_id,Country_name) VALUES (53, 'Cook Islands');
INSERT INTO dbo.tbl_countries (Country_id,Country_name) VALUES (54, 'Costa Rica');
INSERT INTO dbo.tbl_countries (Country_id,Country_name) VALUES (55, 'Côte dIvoire (Ivory Coast)');
INSERT INTO dbo.tbl_countries (Country_id,Country_name) VALUES (56, 'Croatia (Hrvatska)');
INSERT INTO dbo.tbl_countries (Country_id,Country_name) VALUES (57, 'Cuba');
INSERT INTO dbo.tbl_countries (Country_id,Country_name) VALUES (58, 'Cyprus');
INSERT INTO dbo.tbl_countries (Country_id,Country_name) VALUES (59, 'Czech Republic');
INSERT INTO dbo.tbl_countries (Country_id,Country_name) VALUES (60, 'Denmark');
INSERT INTO dbo.tbl_countries (Country_id,Country_name) VALUES (61, 'Djibouti');
INSERT INTO dbo.tbl_countries (Country_id,Country_name) VALUES (62, 'Dominica');
INSERT INTO dbo.tbl_countries (Country_id,Country_name) VALUES (63, 'Dominican Republic');
INSERT INTO dbo.tbl_countries (Country_id,Country_name) VALUES (64, 'East Timor');
INSERT INTO dbo.tbl_countries (Country_id,Country_name) VALUES (65, 'Ecuador');
INSERT INTO dbo.tbl_countries (Country_id,Country_name) VALUES (66, 'Egypt');
INSERT INTO dbo.tbl_countries (Country_id,Country_name) VALUES (67, 'El Salvador');
INSERT INTO dbo.tbl_countries (Country_id,Country_name) VALUES (68, 'Equatorial Guinea');
INSERT INTO dbo.tbl_countries (Country_id,Country_name) VALUES (69, 'Eritrea');
INSERT INTO dbo.tbl_countries (Country_id,Country_name) VALUES (70, 'Estonia');
INSERT INTO dbo.tbl_countries (Country_id,Country_name) VALUES (71, 'Ethiopia');
INSERT INTO dbo.tbl_countries (Country_id,Country_name) VALUES (72, 'Falkland Islands');
INSERT INTO dbo.tbl_countries (Country_id,Country_name) VALUES (73, 'Faroe Islands');
INSERT INTO dbo.tbl_countries (Country_id,Country_name) VALUES (74, 'Fiji');
INSERT INTO dbo.tbl_countries (Country_id,Country_name) VALUES (75, 'Finland');
INSERT INTO dbo.tbl_countries (Country_id,Country_name) VALUES (76, 'France');
INSERT INTO dbo.tbl_countries (Country_id,Country_name) VALUES (77, 'French Guiana');
INSERT INTO dbo.tbl_countries (Country_id,Country_name) VALUES (78, 'French Polynesia');
INSERT INTO dbo.tbl_countries (Country_id,Country_name) VALUES (79, 'French Southern Territories');
INSERT INTO dbo.tbl_countries (Country_id,Country_name) VALUES (80, 'Gabon');
INSERT INTO dbo.tbl_countries (Country_id,Country_name) VALUES (81, 'Gambia');
INSERT INTO dbo.tbl_countries (Country_id,Country_name) VALUES (82, 'Georgia');
INSERT INTO dbo.tbl_countries (Country_id,Country_name) VALUES (83, 'Germany');
INSERT INTO dbo.tbl_countries (Country_id,Country_name) VALUES (84, 'Ghana');
INSERT INTO dbo.tbl_countries (Country_id,Country_name) VALUES (85, 'Gibraltar');
INSERT INTO dbo.tbl_countries (Country_id,Country_name) VALUES (86, 'Greece');
INSERT INTO dbo.tbl_countries (Country_id,Country_name) VALUES (87, 'Greenland');
INSERT INTO dbo.tbl_countries (Country_id,Country_name) VALUES (88, 'Grenada');
INSERT INTO dbo.tbl_countries (Country_id,Country_name) VALUES (89, 'Guadeloupe');
INSERT INTO dbo.tbl_countries (Country_id,Country_name) VALUES (90, 'Guam');
INSERT INTO dbo.tbl_countries (Country_id,Country_name) VALUES (91, 'Guatemala');
INSERT INTO dbo.tbl_countries (Country_id,Country_name) VALUES (92, 'Guinea');
INSERT INTO dbo.tbl_countries (Country_id,Country_name) VALUES (93, 'Guinea-Bissau');
INSERT INTO dbo.tbl_countries (Country_id,Country_name) VALUES (94, 'Guyana');
INSERT INTO dbo.tbl_countries (Country_id,Country_name) VALUES (95, 'Haiti');
INSERT INTO dbo.tbl_countries (Country_id,Country_name) VALUES (96, 'Heard and McDonald Islands');
INSERT INTO dbo.tbl_countries (Country_id,Country_name) VALUES (97, 'Honduras');
INSERT INTO dbo.tbl_countries (Country_id,Country_name) VALUES (98, 'Hong Kong');
INSERT INTO dbo.tbl_countries (Country_id,Country_name) VALUES (99, 'Hungary');
INSERT INTO dbo.tbl_countries (Country_id,Country_name) VALUES (100, 'Iceland');
INSERT INTO dbo.tbl_countries (Country_id,Country_name) VALUES (101, 'India');
INSERT INTO dbo.tbl_countries (Country_id,Country_name) VALUES (102, 'Indonesia');
INSERT INTO dbo.tbl_countries (Country_id,Country_name) VALUES (103, 'Iran');
INSERT INTO dbo.tbl_countries (Country_id,Country_name) VALUES (104, 'Iraq');
INSERT INTO dbo.tbl_countries (Country_id,Country_name) VALUES (105, 'Ireland');
INSERT INTO dbo.tbl_countries (Country_id,Country_name) VALUES (106, 'Israel');
INSERT INTO dbo.tbl_countries (Country_id,Country_name) VALUES (107, 'Italy');
INSERT INTO dbo.tbl_countries (Country_id,Country_name) VALUES (108, 'Jamaica');
INSERT INTO dbo.tbl_countries (Country_id,Country_name) VALUES (109, 'Japan');
INSERT INTO dbo.tbl_countries (Country_id,Country_name) VALUES (110, 'Jordan');
INSERT INTO dbo.tbl_countries (Country_id,Country_name) VALUES (111, 'Kazakhstan');
INSERT INTO dbo.tbl_countries (Country_id,Country_name) VALUES (112, 'Kenya');
INSERT INTO dbo.tbl_countries (Country_id,Country_name) VALUES (113, 'Kiribati');
INSERT INTO dbo.tbl_countries (Country_id,Country_name) VALUES (114, 'Korea (north)');
INSERT INTO dbo.tbl_countries (Country_id,Country_name) VALUES (115, 'Korea (south)');
INSERT INTO dbo.tbl_countries (Country_id,Country_name) VALUES (116, 'Kuwait');
INSERT INTO dbo.tbl_countries (Country_id,Country_name) VALUES (117, 'Kyrgyzstan');
INSERT INTO dbo.tbl_countries (Country_id,Country_name) VALUES (118, 'Lao Peoples Democratic Republic');
INSERT INTO dbo.tbl_countries (Country_id,Country_name) VALUES (119, 'Latvia');
INSERT INTO dbo.tbl_countries (Country_id,Country_name) VALUES (120, 'Lebanon');
INSERT INTO dbo.tbl_countries (Country_id,Country_name) VALUES (121, 'Lesotho');
INSERT INTO dbo.tbl_countries (Country_id,Country_name) VALUES (122, 'Liberia');
INSERT INTO dbo.tbl_countries (Country_id,Country_name) VALUES (123, 'Libyan Arab Jamahiriya');
INSERT INTO dbo.tbl_countries (Country_id,Country_name) VALUES (124, 'Liechtenstein');
INSERT INTO dbo.tbl_countries (Country_id,Country_name) VALUES (125, 'Lithuania');
INSERT INTO dbo.tbl_countries (Country_id,Country_name) VALUES (126, 'Luxembourg');
INSERT INTO dbo.tbl_countries (Country_id,Country_name) VALUES (127, 'Macao');
INSERT INTO dbo.tbl_countries (Country_id,Country_name) VALUES (128, 'Macedonia');
INSERT INTO dbo.tbl_countries (Country_id,Country_name) VALUES (129, 'Madagascar');
INSERT INTO dbo.tbl_countries (Country_id,Country_name) VALUES (130, 'Malawi');
INSERT INTO dbo.tbl_countries (Country_id,Country_name) VALUES (131, 'Malaysia');
INSERT INTO dbo.tbl_countries (Country_id,Country_name) VALUES (132, 'Maldives');
INSERT INTO dbo.tbl_countries (Country_id,Country_name) VALUES (133, 'Mali');
INSERT INTO dbo.tbl_countries (Country_id,Country_name) VALUES (134, 'Malta');
INSERT INTO dbo.tbl_countries (Country_id,Country_name) VALUES (135, 'Marshall Islands');
INSERT INTO dbo.tbl_countries (Country_id,Country_name) VALUES (136, 'Martinique');
INSERT INTO dbo.tbl_countries (Country_id,Country_name) VALUES (137, 'Mauritania');
INSERT INTO dbo.tbl_countries (Country_id,Country_name) VALUES (138, 'Mauritius');
INSERT INTO dbo.tbl_countries (Country_id,Country_name) VALUES (139, 'Mayotte');
INSERT INTO dbo.tbl_countries (Country_id,Country_name) VALUES (140, 'Mexico');
INSERT INTO dbo.tbl_countries (Country_id,Country_name) VALUES (141, 'Micronesia');
INSERT INTO dbo.tbl_countries (Country_id,Country_name) VALUES (142, 'Moldova');
INSERT INTO dbo.tbl_countries (Country_id,Country_name) VALUES (143, 'Monaco');
INSERT INTO dbo.tbl_countries (Country_id,Country_name) VALUES (144, 'Mongolia');
INSERT INTO dbo.tbl_countries (Country_id,Country_name) VALUES (145, 'Montserrat');
INSERT INTO dbo.tbl_countries (Country_id,Country_name) VALUES (146, 'Morocco');
INSERT INTO dbo.tbl_countries (Country_id,Country_name) VALUES (147, 'Mozambique');
INSERT INTO dbo.tbl_countries (Country_id,Country_name) VALUES (148, 'Myanmar');
INSERT INTO dbo.tbl_countries (Country_id,Country_name) VALUES (149, 'Namibia');
INSERT INTO dbo.tbl_countries (Country_id,Country_name) VALUES (150, 'Nauru');
INSERT INTO dbo.tbl_countries (Country_id,Country_name) VALUES (151, 'Nepal');
INSERT INTO dbo.tbl_countries (Country_id,Country_name) VALUES (152, 'Netherlands');
INSERT INTO dbo.tbl_countries (Country_id,Country_name) VALUES (153, 'Netherlands Antilles');
INSERT INTO dbo.tbl_countries (Country_id,Country_name) VALUES (154, 'New Caledonia');
INSERT INTO dbo.tbl_countries (Country_id,Country_name) VALUES (155, 'New Zealand');
INSERT INTO dbo.tbl_countries (Country_id,Country_name) VALUES (156, 'Nicaragua');
INSERT INTO dbo.tbl_countries (Country_id,Country_name) VALUES (157, 'Niger');
INSERT INTO dbo.tbl_countries (Country_id,Country_name) VALUES (158, 'Nigeria');
INSERT INTO dbo.tbl_countries (Country_id,Country_name) VALUES (159, 'Niue');
INSERT INTO dbo.tbl_countries (Country_id,Country_name) VALUES (160, 'Norfolk Island');
INSERT INTO dbo.tbl_countries (Country_id,Country_name) VALUES (161, 'Northern Mariana Islands');
INSERT INTO dbo.tbl_countries (Country_id,Country_name) VALUES (162, 'Norway');
INSERT INTO dbo.tbl_countries (Country_id,Country_name) VALUES (163, 'Oman');
INSERT INTO dbo.tbl_countries (Country_id,Country_name) VALUES (164, 'Pakistan');
INSERT INTO dbo.tbl_countries (Country_id,Country_name) VALUES (165, 'Palau');
INSERT INTO dbo.tbl_countries (Country_id,Country_name) VALUES (166, 'Palestinian Territories');
INSERT INTO dbo.tbl_countries (Country_id,Country_name) VALUES (167, 'Panama');
INSERT INTO dbo.tbl_countries (Country_id,Country_name) VALUES (168, 'Papua New Guinea');
INSERT INTO dbo.tbl_countries (Country_id,Country_name) VALUES (169, 'Paraguay');
INSERT INTO dbo.tbl_countries (Country_id,Country_name) VALUES (170, 'Peru');
INSERT INTO dbo.tbl_countries (Country_id,Country_name) VALUES (171, 'Philippines');
INSERT INTO dbo.tbl_countries (Country_id,Country_name) VALUES (172, 'Pitcairn');
INSERT INTO dbo.tbl_countries (Country_id,Country_name) VALUES (173, 'Poland');
INSERT INTO dbo.tbl_countries (Country_id,Country_name) VALUES (174, 'Portugal');
INSERT INTO dbo.tbl_countries (Country_id,Country_name) VALUES (175, 'Puerto Rico');
INSERT INTO dbo.tbl_countries (Country_id,Country_name) VALUES (176, 'Qatar');
INSERT INTO dbo.tbl_countries (Country_id,Country_name) VALUES (177, 'Réunion');
INSERT INTO dbo.tbl_countries (Country_id,Country_name) VALUES (178, 'Romania');
INSERT INTO dbo.tbl_countries (Country_id,Country_name) VALUES (179, 'Russian Federation');
INSERT INTO dbo.tbl_countries (Country_id,Country_name) VALUES (180, 'Rwanda');
INSERT INTO dbo.tbl_countries (Country_id,Country_name) VALUES (181, 'Saint Helena');
INSERT INTO dbo.tbl_countries (Country_id,Country_name) VALUES (182, 'Saint Kitts and Nevis');
INSERT INTO dbo.tbl_countries (Country_id,Country_name) VALUES (183, 'Saint Lucia');
INSERT INTO dbo.tbl_countries (Country_id,Country_name) VALUES (184, 'Saint Pierre and Miquelon');
INSERT INTO dbo.tbl_countries (Country_id,Country_name) VALUES (185, 'Saint Vincent and the Grenadines');
INSERT INTO dbo.tbl_countries (Country_id,Country_name) VALUES (186, 'Samoa');
INSERT INTO dbo.tbl_countries (Country_id,Country_name) VALUES (187, 'San Marino');
INSERT INTO dbo.tbl_countries (Country_id,Country_name) VALUES (188, 'Sao Tome and Principe');
INSERT INTO dbo.tbl_countries (Country_id,Country_name) VALUES (189, 'Saudi Arabia');
INSERT INTO dbo.tbl_countries (Country_id,Country_name) VALUES (190, 'Senegal');
INSERT INTO dbo.tbl_countries (Country_id,Country_name) VALUES (191, 'Serbia and Montenegro');
INSERT INTO dbo.tbl_countries (Country_id,Country_name) VALUES (192, 'Seychelles');
INSERT INTO dbo.tbl_countries (Country_id,Country_name) VALUES (193, 'Sierra Leone');
INSERT INTO dbo.tbl_countries (Country_id,Country_name) VALUES (194, 'Singapore');
INSERT INTO dbo.tbl_countries (Country_id,Country_name) VALUES (195, 'Slovakia');
INSERT INTO dbo.tbl_countries (Country_id,Country_name) VALUES (196, 'Slovenia');
INSERT INTO dbo.tbl_countries (Country_id,Country_name) VALUES (197, 'Solomon Islands');
INSERT INTO dbo.tbl_countries (Country_id,Country_name) VALUES (198, 'Somalia');
INSERT INTO dbo.tbl_countries (Country_id,Country_name) VALUES (199, 'South Africa');
INSERT INTO dbo.tbl_countries (Country_id,Country_name) VALUES (200, 'South Georgia and the South Sandwich Islands');
INSERT INTO dbo.tbl_countries (Country_id,Country_name) VALUES (201, 'Spain');
INSERT INTO dbo.tbl_countries (Country_id,Country_name) VALUES (202, 'Sri Lanka');
INSERT INTO dbo.tbl_countries (Country_id,Country_name) VALUES (203, 'Sudan');
INSERT INTO dbo.tbl_countries (Country_id,Country_name) VALUES (204, 'Suriname');
INSERT INTO dbo.tbl_countries (Country_id,Country_name) VALUES (205, 'Svalbard and Jan Mayen Islands');
INSERT INTO dbo.tbl_countries (Country_id,Country_name) VALUES (206, 'Swaziland');
INSERT INTO dbo.tbl_countries (Country_id,Country_name) VALUES (207, 'Sweden');
INSERT INTO dbo.tbl_countries (Country_id,Country_name) VALUES (208, 'Switzerland');
INSERT INTO dbo.tbl_countries (Country_id,Country_name) VALUES (209, 'Syria');
INSERT INTO dbo.tbl_countries (Country_id,Country_name) VALUES (210, 'Taiwan');
INSERT INTO dbo.tbl_countries (Country_id,Country_name) VALUES (211, 'Tajikistan');
INSERT INTO dbo.tbl_countries (Country_id,Country_name) VALUES (212, 'Tanzania');
INSERT INTO dbo.tbl_countries (Country_id,Country_name) VALUES (213, 'Thailand');
INSERT INTO dbo.tbl_countries (Country_id,Country_name) VALUES (214, 'Togo');
INSERT INTO dbo.tbl_countries (Country_id,Country_name) VALUES (215, 'Tokelau');
INSERT INTO dbo.tbl_countries (Country_id,Country_name) VALUES (216, 'Tonga');
INSERT INTO dbo.tbl_countries (Country_id,Country_name) VALUES (217, 'Trinidad and Tobago');
INSERT INTO dbo.tbl_countries (Country_id,Country_name) VALUES (218, 'Tunisia');
INSERT INTO dbo.tbl_countries (Country_id,Country_name) VALUES (219, 'Turkey');
INSERT INTO dbo.tbl_countries (Country_id,Country_name) VALUES (220, 'Turkmenistan');
INSERT INTO dbo.tbl_countries (Country_id,Country_name) VALUES (221, 'Turks and Caicos Islands');
INSERT INTO dbo.tbl_countries (Country_id,Country_name) VALUES (222, 'Tuvalu');
INSERT INTO dbo.tbl_countries (Country_id,Country_name) VALUES (223, 'Uganda');
INSERT INTO dbo.tbl_countries (Country_id,Country_name) VALUES (224, 'Ukraine');
INSERT INTO dbo.tbl_countries (Country_id,Country_name) VALUES (225, 'United Arab Emirates');
INSERT INTO dbo.tbl_countries (Country_id,Country_name,Sort_order) VALUES (226, 'United Kingdom',2);
INSERT INTO dbo.tbl_countries (Country_id,Country_name,Sort_order) VALUES (227, 'United States of America',1);
INSERT INTO dbo.tbl_countries (Country_id,Country_name) VALUES (228, 'Uruguay');
INSERT INTO dbo.tbl_countries (Country_id,Country_name) VALUES (229, 'Uzbekistan');
INSERT INTO dbo.tbl_countries (Country_id,Country_name) VALUES (230, 'Vanuatu');
INSERT INTO dbo.tbl_countries (Country_id,Country_name) VALUES (231, 'Vatican City');
INSERT INTO dbo.tbl_countries (Country_id,Country_name) VALUES (232, 'Venezuela');
INSERT INTO dbo.tbl_countries (Country_id,Country_name) VALUES (233, 'Vietnam');
INSERT INTO dbo.tbl_countries (Country_id,Country_name) VALUES (234, 'Virgin Islands (British)');
INSERT INTO dbo.tbl_countries (Country_id,Country_name) VALUES (235, 'Virgin Islands (US)');
INSERT INTO dbo.tbl_countries (Country_id,Country_name) VALUES (236, 'Wallis and Futuna Islands');
INSERT INTO dbo.tbl_countries (Country_id,Country_name) VALUES (237, 'Western Sahara');
INSERT INTO dbo.tbl_countries (Country_id,Country_name) VALUES (238, 'Yemen');
INSERT INTO dbo.tbl_countries (Country_id,Country_name) VALUES (239, 'Zaire');
INSERT INTO dbo.tbl_countries (Country_id,Country_name) VALUES (240, 'Zambia');
INSERT INTO dbo.tbl_countries (Country_id,Country_name) VALUES (241, 'Zimbabwe');
--STEP 4: SET IDENTITY INSERT OFF
SET IDENTITY_INSERT dbo.tbl_countries OFF
GO
--STEP 5: CREATE VIEW
CREATE VIEW dbo.vwCountries AS
SELECT
[Country_id]
,[Country_name]
,[Country_ShortName]
,[Sort_order]
,[Active]
FROM [dbo].[tbl_Countries]
--STEP 6: SELECT FROM VIEW
GO
SELECT
[Country_id]
,[Country_name]
,[Country_ShortName]
FROM [dbo].vwCountries
WHERE [Active] = 1
order by isnull([Sort_order],99), [Country_id]