Monday, December 03, 2012

SharePoint Field set to Required but still doesn't require Input

One of common mistake when making  content type/list using sharepoint schema is to make the required field field as

Required="True" or Required ="ture"

if you pick the value true for the the field as specified above, Visual Studio doesn't give you any error and you can deploy your content type and list with out any errors.
But when you try to enter value for field, you will see that the field is not mandatory OR no redstar (required field indication) on add form of that field.

This will not make this field required.


 ID="{070e50ac-f9c1-4d4c-b1f9-de0bcac300f6}" Name="test" DisplayName="test" Type="text"  Required="true" Group="MytestGroup" ColName="test"/>

...

 ID="0x01000a4547a7e98c46248e063d79ddd67f5c"
           Name="TESTContent Type"
           Group="MyGroup"
           Description="Test Content Type Description"
           Inherits="FALSE"
           Overwrite="TRUE"
           Version="0">


 ID="{070e50ac-f9c1-4d4c-b1f9-de0bcac300f6}" Name="Price" DisplayName="test" Required="True" />    
This will not make this field required.
 ID="{070e50ac-f9c1-4d4c-b1f9-de0bcac300f6}" Name="test" DisplayName="test" Type="text"  Required="true" Group="MytestGroup" ColName="test"/>

...

 ID="0x01000a4547a7e98c46248e063d79ddd67f5c"
           Name="TESTContent Type"
           Group="MyGroup"
           Description="Test Content Type Description"
           Inherits="FALSE"
           Overwrite="TRUE"
           Version="0">


 ID="{070e50ac-f9c1-4d4c-b1f9-de0bcac300f6}" Name="Price" DisplayName="test" Required="True" />    
This will  make this field required.
 ID="{070e50ac-f9c1-4d4c-b1f9-de0bcac300f6}" Name="test" DisplayName="test" Type="text"  Required="true" Group="MytestGroup" ColName="test"/>

...

 ID="0x01000a4547a7e98c46248e063d79ddd67f5c"
           Name="TESTContent Type"
           Group="MyGroup"
           Description="Test Content Type Description"
           Inherits="FALSE"
           Overwrite="TRUE"
           Version="0">


 ID="{070e50ac-f9c1-4d4c-b1f9-de0bcac300f6}" Name="Price" DisplayName="test" Required="true" />    

Wednesday, November 28, 2012

Loading form Library(created programmatically) in InfoPath form

Scenario:
1) Form Library is created using Visual Studio 2010 ....follow the link below for steps of creating form library using visual studio.
http://microsofttechnologies.blogspot.com.au/2012/11/creating-sp-2010-form-library-using.html


2) Infopath form is created with few fields on it , when the user tries to publish the form to form library which was created using Visual Studio....it doesn't appear in Infpath Form Library list.


Solution:


Open List Definition in Visual Studio and change URL by removing List before slash 


Wrong-----This form library will not appear in infopath form when we try to publish a form and want to select a form library which was created before..


 
                OnQuickLaunch="TRUE"
                TemplateType="115"
                Url="Lists\ListURL"  
                Description="List Description">
 





Correct-----This form library will appear in infopath form when we try to publish a form and want to select a form library which was created before..
 
                OnQuickLaunch="TRUE"
                TemplateType="115"
                Url="ListURL"  
                Description="List Description">
 

Creating SP 2010 Form Library using Visual Studio 2010

1) Open Visual Studio, in New Project select SharePoint 2010 and then select an empty project. (Create an empty SharePoint project)

2) Add a new List or List based on selected content type. 

3) Open List template definition and change it to (List Template not list definition)
  
        Name="ListName"
        Type="115"        
        BaseType="1"  
        OnQuickLaunch="TRUE" 
        SecurityBits="11" 
        Sequence="120" 
        DisplayName="List Display Name" 
        Description="List Description" 
        Image="/_layouts/images/itfl.png"  
        DocumentTemplate="1000"/> 


4) Build the project and deploy it, it will create a form library in SharePoint with the name you specified above. 

Promoting Infopath form fields to SharePoint - with out duplication

Scenario:
SharePoint 2010 form library is created using object model or schema definition in Visual Studio 2010 and form is created in InfoPath 2010 using InfoPath designer, When the fields are promoted to SharePoint Form library from InfoPath form it duplicates the filed in Form Library.


Solution:
When you promote a field from infopath form to sharepoint it creates a new field in form library with the name of promoted field, even if the field with that name exist it  creates a new field and give it different internal name.

Solution is when you are promoting a field from infopath form , select that field modify it select the SiteColumn group and SiteColumn from dropdowns as shown in figure belw....


For Example: if you have created a column which exist in DSL Columns group select DSL Columns from drop down.

now select the name of field from Site Column and click ok

Do same steps for all promoted fields...if you have already created those fields in FormLibrary...

Check the Image below with screenshot highlighting points above ...


Tuesday, November 20, 2012

Create a content type with out Title Field

Scenario:-


Create a content type in SharePoint 2010 based on item content type but it should not have a title field.


Solution:-
1) Create an empty solution in visual studio 2010.

2) Add new item-> Content Type

3) Extend your content type from item content type.

4) now open the file and change inherits to False.



                 Name="ContentTypeName"
               Group="ContentType Group"
               Description="ContentType Description"
               Inherits="FALSE"
               Version="0">

Sunday, November 18, 2012

Set Default Value in People Picker Field

This post explains that how to set default value in people picker field in infopath 2010, i have picked current user in my example but it can be another field value on form, any function etc...
People picker field has
Display Name
AccountID
Account Type

in it....
you can set default values for each of these fields....
1) Add a people picker on infopath form
2) Take properties of any of above (sub fields) [I have picked Account ID in my example]
You can take properties by selecting AccountID in left hand field pan and right click, properties.
3) Set the default value for this as show in image below....
[i set it to current user, you can pick any other field value or function etc]

Sunday, October 07, 2012

SharePoint 2010 - Programmatically Copy Picture to Image Library on Item Added

SharePoint 2010 - Pro grammatically Copy Picture to Image Library on Item Added
Scenario:
Two Picture Libraries
PicLib and PicLib2

Requirement:
When an image is uploaded by user in First Picture Library upload the same image in PicLib2.
Solution
Create a new Project in VS 2010 (Event Receiver Project)
Select the site where you want to deploy this
Select the source List (PicLib in our scenario) and ItemAdded event
Write Code below in ItemAdded

public override void ItemAdded(SPItemEventProperties properties)
{
base.ItemAdded(properties);

try
{
SPList lib1 = (SPDocumentLibrary) properties.Web.Lists ["piclib"];
SPList lib2 = (SPDocumentLibrary)properties.Web.Lists["piclib2"];
SPListItem item1 = properties.ListItem;
byte[] fileBytes = item1.File.OpenBinary();
string destinationUrl = lib2.RootFolder.Url + "/" + item1.File.Name;
SPFile destFile = lib2.RootFolder.Files.Add(destinationUrl , fileBytes, true);

}
catch (Exception e)
{
throw e;
}
}

Tuesday, September 25, 2012

September 2012 Perth SharePoint User Group - Apps for SharePoint 2013

September 2012 Perth SharePoint User Group Meeting - Apps for SharePoint 2013 Perth SharePoint User Group Tuesday, September 25, 2012 from 12:15 PM to 1:15 PM (WST) Perth, Australia For the September 2012 Perth SharePoint User Group meeting, Khalil Khan, Perth based SharePoint Server MVP and SharePoint Architect at Velrada will be presenting on the new App Model for SharePoint 2013. SharePoint 2013 has introduced exciting new features for both the developers and business users alike. This session will focus on this new App Model and how to make best use of it for building effective SharePoint solutions. The presentation will cover: A brief overview of App Model for SharePoint 2013; Comparison of app models with SharePoint Solutions; Design Considerations and Development Tools; and Building/Deploying Apps for SharePoint 2013. Velrada is proud to sponsor the event, with a pizza lunch provided. http://september2012perthsharepointusergroup.eventbrite.com/?ref=esfbenivte001

Tuesday, September 11, 2012

Authentication Model in SharePoint 2013



New Authentication Model in SharePoint 2013
SP 2013 preview is available now for few weeks and I am sure many of you have tried SharePoint 2013 by installing it on your standalone box/VM or by getting an account on SharePoint Online, When you log into SharePoint for the first time it looks like that nothing has really changed in terms of authentication but when you dig down Microsoft has made changes to authentication model of SharePoint 2013.

In SharePoint 2010 Claims based authentication was the default authentication mode for SharePoint 2013 web apps and now SharePoint can leverage OAuth and Server to Server (S2S Authentication)

Background of Authentication in SharePoint from 2007 to 2013
MOSS 2007 was base d on capabilities of IIS to provide authentication what we call Classic Authentication Mode, Classic Auth support Basic and Forms Auth , NTML or Kerberos modes but at one time single authentication mechanism was supported on a MOSS web application.
SharePoint 2010 introduced a new authentication mode what we call Claims based authentication, Claims supports FBA and Basic but still Classic was default auth mode for SP 2010 apps.
Claims based auth uses “tokens” that identify the user and specific, customizable attributes about the user (username, email, full name, etc.). Each attribute is known as a claim.
In Preview SharePoint 2013 doesn’t support Classic Auth from UI but you can still do that using power shell .

Server to Server (S2S) Authentication and OAuth for SP 2013 Apps

Server to Server Authentication is another change in auth area in Sharepoint 2013, New server products including SharePoint 2013, Exchange and Lync 2013 are using S2S . This is similar to OAuth for Applications but is for an entire server and is actually delegating the user’s identity to the remote server.
S2S relies on claims behind the scenes to delegate the user’s identity. Where it differs from straight claims is that the delegation is automatic and doesn’t have to be initiated by the user.

OAuth is some thing which is there for a while now and the current version of OAuth is I believe OAuth 2, it is used widely on web these days specially on social networking Apps including open social etc.
In SharePoint 2013, OAuth provides authorization for apps to access specific user resources without the user needing to provide credentials to the app. The idea is to establish a trust ….. Regardless of where the app is actually hosted (on-premise or in the cloud), between the app server and SharePoint allowing the app access to the resources it’s requested.

In the case of an on-premise app, everything is negotiated between the server and SharePoint and an implicit trust exists. This comes from the app being hosted on SharePoint. For the case of cloud-based apps, SharePoint trusts the Azure Access Control Service (ACS).

Saturday, September 08, 2012

Apps in SharePoint 2013 Online Event

Khalil ur Rehman, SharePoint Server MCTS / MVP will be presenting on the new App Model for SharePoint 2013. SharePoint 2013 has introduced exciting new features for both the developers and business users alike. This session will focus on this new App Model and how to make best use of it for building effective SharePoint solutions. The presentation will cover: A brief overview of App Model for SharePoint 2013; Comparison of app models with SharePoint Solutions; Design Considerations and Development Tools; and Building/Deploying Apps for SharePoint 2013. This is an online event , If you want to join the event send an email to khalil.urrehman@gmail.com to get a meeting invite to join the session.... Date: 6th Oct, 2012 Time: 9 am to 10 am (Pakistan Standard Time) https://www.eventbrite.com/event/4042069940?utm_source=eb_email&utm_medium=email&utm_campaign=new_attendee&utm_term=event_name

Wednesday, August 29, 2012

SharePoint Content Database in Suspect Mode

If you are getting this error message while accessing SharePoint

"Cannot connect to the configuration database"

There can be several reasons for this and some of them are described here with possible solutions
http://support.microsoft.com/kb/823287

but another reason is that when your database goes to suspect mode you will get the same error.

What Does Suspect Mode Means?

There are different reasons for database to go in suspect mode like error in its physical files e.g:- log file.

It is difficult to make database online when made as suspect database. There are several ways we can identify that a database is in suspect mode.


I used the following commands to bring my database online



exec sp_resetstatus DBNAME

ALTER DATABASE DBNAME SET EMERGENCY
GO

ALTER DATABASE DBNAME SET SINGLE_USER
GO


DBCC CheckDB (DBNAME , REPAIR_ALLOW_DATA_LOSS)
GO

ALTER DAtabase DBNAME SET MULTI_USER
GO



examples of these command with DBNAme is


exec sp_resetstatus 'SharePoint_Config_703e926e-d84f-4ab1-941e-308e85137400'
ALTER DATABASE [SharePoint_Config_703e926e-d84f-4ab1-941e-308e85137400] SET EMERGENCY
GO
ALTER DATABASE [SharePoint_Config_703e926e-d84f-4ab1-941e-308e85137400] SET SINGLE_USER
GO
DBCC CheckDB ([SharePoint_Config_703e926e-d84f-4ab1-941e-308e85137400] , REPAIR_ALLOW_DATA_LOSS)
GO

ALTER DAtabase [SharePoint_Config_703e926e-d84f-4ab1-941e-308e85137400] SET MULTI_USER
GO





Wednesday, August 22, 2012

Error on Webpart Page

I have seen many information workers and sharepoint developers struggling with this basic issue in which they created a custom webpart/or used an OOB webpart.... added it to a webpart page....if there are some errors/issues in webpart .....NOW when they open the page they can't see the contents of that page , neither they can edit the page from ribbon because they are getting an error message on page due to error in webpart.....


a very simple solution to this problem is to add a query string parameter

?contents=1 at the end of page ......this will open the page in a mode where you will be able to remove items from your page

so lets say URL of your webpart page was

http://servername/pages/abc.aspx

you should type

http://servername/pages/abc.aspx?contents=1


Monday, August 13, 2012

Virtual Event - Office 15/SP 2013 Installation and Preview

In SharePoint world, everybody is talking about SP 2013 and Office 15 products these days, Microsoft has made it easy for users to experience the product features by first time providing

SharePoint Online and On campus installation option together but many of users, especially who are relatively new to SharePoint are not familiar with Online option, some are facing issues in installation of version on local VMs.

Let’s look at these options and issues together in a live session and Fix them

• SP 2013 online V/S Offline
• Set up your account for installation on Office 365/SharePoint Online and Product Preview
• Software Requirement of Standalone Installation
• Hardware Requirements of Standalone Installation
• Installation issues of SP 2013 standalone
• How to fix the installation issues

Join me on Live Meeting for a session on Installation and Configuration of SharePoint 2013 CP , Office 15 CP Products and High level preview.

Venue: Live Meeting (Send me an email at khalil.urrehman@gmail.com ) to book a slot [Limited to 15 users, first come first serve]
Date & Time: Saturday, 19th August, 2012 2 PM Pakistan Standard Time (GMT+5)

Monday, July 23, 2012

SharePoint 2013 training for IT pro

IT Professional training for SharePoint 2013 how to training and walkthrough videos about Office 2013 and SharePoint 2013 including changes and new features for search, social, ECM, WCM, and REST are now available on technet.

http://technet.microsoft.com/en-us/sharepoint/fp123606.aspx

SharePoint 2013 Installation

I am getting many emails from my old colleagues friends about SP 2013 and the issues which they were facing in installation of SP2013, Given below are the steps shared by a fellow Colleague David Piscopo

I thought that its worth sharing on my blow


Installation Steps SharePoint 2013

Steps
1. Install Windows Server 2008 R2
2. Install Service Pack 1 for Windows Server R2 (the pre-requisite checker does not fulfil this and it has to be installed separately). This can take up to an hour to install)
3. Run the default.hta from the install media
4. Select ‘Install software Prerequisites’ and let it do its thing. This may take a while and there may be several reboots
5. Run ‘Install SharePoint Foundation’ when the pre-requisites are done
6. At the end of the install you will be asked to install the ‘Configuration Wizard’. DO NOT DO THIS as your install will fail.
7. Open the local services and locate the ‘AppFabricCachingService’ service. Change the logon identity of this service so that it is using a local admin account rather than the Network Service
8. Start the AppFabricCachingService service if not already started.
9. Start a command prompt as Administrator and change directory to ‘C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\15\BIN’ (or add the path to your environment – recommended)
10. Execute PSCONFIG to create the config database

PSCONFIG.EXE -cmd Configdb create SkipRegisterAsDistributedCacheHost

This will take a while to complete
SharePoint Products Configuration Wizard version 15.0.4128.1014. Copyright (C) Microsoft Corporation 2010. All rights reserved.

Performing configuration task 1 of 3
Initializing SharePoint Products configuration...

Successfully initialized the SharePoint Products configuration.

Performing configuration task 2 of 3
Creating the configuration database...

Successfully created the configuration database.

Performing configuration task 3 of 3
Finalizing the SharePoint Products configuration...

Successfully completed the SharePoint Products configuration.

Total number of configuration settings run: 3
Total number of successful configuration settings: 3
Total number of unsuccessful configuration settings: 0
Successfully stopped the configuration of SharePoint Products.
Configuration of the SharePoint Products has succeeded.

11. Re-run the ‘SharePoint 2013 Products Configuration Wizard’. You may get an error at the end of process regarding Sample Data. Disregard this



You should now be good to go.

Sunday, July 22, 2012

What's New in SharePoint 2013 Preview - Part 1

What's New in SharePoint 2013 Preview - Part 1

Given Below is a summary from my notes----A Ten Thousand Feet view of SP 2013 Preview...

Whats new in SharePoint 2013



Supported Browsers
IE 8
IE 9
Mozilla, Chrome and Safari supported with limitations



New Things in SharePoint 15

WebApps is nolonger a Service application
WebAnalystis in no longer a service app , its merged into Search


WCM
Support the tools and workflows designers use
Variations & Content Translation
Search Engine Optimization
Cross Site Publishing
Video & Embedding
Image renditions
Clean Urls
Metadata navigation


Social
Huge Investments by Microsoft in Social Area
MicroBlogging
Acvity Feeds
Communities


Search
Unified Search NOW
Pesonalized Search Results



Stay social with the people who are important to yu
Improved Connections B/w People and Conversatioins in Context
Social Data ---on Hand HELDS
Yammer Integration.....NOT IN THIS RELEASE ....will be available in release
Look and Feel

New Global Navigation Bar with
NewsFeed
SkyDrive
Sites


Open Document/Video/Office in Same view ....in your feed


you can follow a tag...so when any body will make a post you will get notified.....



Different Views of News Feed

Following
EveryOne
Mentions

Create New Tag

Sites which you are following will appear in prview

Lync Hover Card which shows your Lync card information


SharePoint 2013 Hardware/Software Requirements

These are the minimum hardware and software requirements for SharePoint 2013 as per available preview.

Minimum Hardware Requirements

Processor: 64-bit, 4 cores
RAM:
8 GB for production use
4 GB for developer or evaluation use
Hard disk:
80 GB free for system drive
Maintain 2x free space as available RAM


Software REquirements
64-bit edition of Microsoft SQL Server 2008 R2 Service Pack 1

64-bit edition of Windows Server 2008 R2 Service Pack 1 (SP1) Standard, Enterprise, Data Center, or Web Server

Friday, July 20, 2012

Fab 40 Update - SharePoint 2010 Templates

Updated version of SharePoint 2010 Fab 40 templates are available at

www.techsolutions.net/SharePointSolutions.aspx

Sunday, July 15, 2012

Free Microsoft SharePoint 2010 and SharePoint Online templates for government

To provide better access to SharePoint community working on Government Projects, Microsoft has provided a link for GOVERNMENT Templates created by me on website.

You can access it here

http://www.microsoft.com/government/en-us/campaigns/Pages/SharePoint-Templates.aspx

These templates are available for SharePoint 2010 and SharePoint Online.

If you find any issue in installations of these templates feel free to write me at
khalil.urrehman@gmail.com


Thursday, July 12, 2012

Web Analytics with Title

Alot of people are on different forums have put up a requirement to get Titles displayed in Webanalytics instead of URLs, i don't know why webanalytics doesn't allow this in first place :)

But any way, i have a code snippet from Farhan Faiz on subject but have noticed that it has some limitations....


I have tried to get another version of WebAnalytics which which is working for me in sites/sub sites

Try and share your feedback....


Steps to Setup this in your DEV environment

1) Create an empty project in VS 2010
2) Add a new WebPart
3) Build and Deploy this blank webpart
4) Add it to your sharepoint site


5) Add Reference to
C:\Windows\assembly\GAC_MSIL\Microsoft.Office.Server.WebAnalytics.UI\14.0.0.0__71e9bce111e9429c\Microsoft.Office.Server.WebAnalytics.UI.dll

in your project

6) Rename Webpart class to TitleAnalystics and Replace code in webpart.cs file with the one listed below

7) Build and Deploy this updated Webpart




using System;
using System.ComponentModel;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using Microsoft.SharePoint;
using Microsoft.SharePoint.WebControls;
using System.Text.RegularExpressions;

namespace TitleAnalystics.TitleAnalystics
{
[ToolboxItemAttribute(false)]
public class TitleAnalystics : Microsoft.Office.Server.WebAnalytics.Reporting.WhatsPopularWebPart, ICallbackEventHandler
{

// Make sure that double quotes and single quotes are copied correctly, when you copy html and past it to Visual Studio sometimes it changes the character.


private const string ItemRegEx = @"(?[^<]*)";


private static string ReplaceUrlsWithTitles(string html)
{


if (Regex.IsMatch(html, ItemRegEx))
{


html = Regex.Replace(html, ItemRegEx, delegate(Match match)
{


var url = match.Groups["url"].Value;


string title = url;


using (SPSite spSite = new SPSite(SPContext.Current.Site.Url))
{

using (SPWeb spWeb = spSite.OpenWeb(title))
{

try
{


var item = spWeb.GetListItem(title);



if (item != null)
{

title = item.DisplayName;


}

else
{
//var item2 = SPContext.Current.Site.RootWeb.GetListFromUrl(url);
var item2 = spWeb.GetListFromUrl(url);
title = item2.Title;
}


}

catch (Exception e) { }


}


}

return "" + title + "";


}, RegexOptions.IgnoreCase);


}

return html;


}


string ICallbackEventHandler.GetCallbackResult()
{

return ReplaceUrlsWithTitles(base.GetCallbackResult());


}

void ICallbackEventHandler.RaiseCallbackEvent(string eventArgument)
{

base.RaiseCallbackEvent(eventArgument);


}
}
}

Announcements with Image - SharePoint 2010


Given below are the steps to configure Announcement web part with image

Steps to Display Image in an Announcements List.

• Create an Announcement List
o Create->List->Announcements
o Name the List

• Go to List Settings and check if you have Page Image Column available in list settings

• If you can't find a Page Image Column, click Add existing Site Column

• Select Page Image Column from the List.

• Select the option of , Add this column to your default view

• Now come your home page(Page where you want to add announcement web part with image)

• Add a content Query web part and go to settings of CQWP.

• in Query Section select your previously created announcement list as source. (show items from this list type)

• Scroll down to Fields to Display section under Presentation in settings of CQWP

• In Title Add the name of Column (list column) in this format List Column [Group of List Column] e.g: Title[Custom Columns]

• In Image section add name of image column in this format List Column [Group of List Column] e.g:- Page Image[Page Layout Image]

• you can apply different styles available in Styles column by making combination of Group Style and Item Style: e.g: Group Style Default and Item Style Fixed Image Size

• click apply and ok and you will start seeing the data in your CQWP


Customizing column width/image size etc

Open the site in SharePoint Designer
Open All Files->Style Library->ItemStyle.xsl

This xsl has styles which are applied on CQWP, so you may want to override some of them to make any changes.

Friday, June 08, 2012

Windows Azure Lunch event (complete cloud environment)


After successfully lunch SQL Azure services now Microsoft launch Windows Azure. A complete and comprehensive platform for developing and deploying applications. It is now integrated for Windows, Mac, Linux OS developers as well. Supporting more then one Db like SQL SERVER, MySQL, Mongo DB etc.

For detail look at the Scott Guthrie (CVP Windows Azure, Application plateform) presentation at Microsoft platform.


Windows Azure provides a Microsoft Windows Server-based computing environment for applications and persistent storage for both structured and unstructured data, as well as asynchronous messaging. Windows Azure also provides a range of services that helps you connect users and on-premises applications to cloud-hosted applications, manage authentication, use inter-service messaging, and implement data management and related features such as caching.

SQL Azure is essentially SQL Server provided as a service in the cloud.

Major features are:

Compute Environment
  • Windows Azure Compute (Web and Worker Roles).
  • Virtual Machine (VM role). 

Data Management

  • Windows Azure Storage.
  • SQL Azure Database.
  • Data Synchronization.
  • Caching. 

Networking Services

  • Content Delivery Network (CDN). 
  • Virtual Network Connect.
  • Virtual Network Traffic Manager. 
  • Access Control (ACS).
  • Service Bus.

Other Services

  • Business Intelligence Reporting. 
  • Marketplace. 

Tuesday, May 29, 2012

Hash functions to improve string comparison and DB desgin


Scenario

I have gone through some difficult experience to compare strings much time during database design and Querying and think about we need to get some different solution to perform same operation. Many times there are requirements to create Varchar field as Primary column like Account Number in Chart of Account table in Accounts software or Comments column in any table with varchar(max) or (100) etc.

Problem

When we try to join string based column or use in our where clause even to find a single record with like or equals clause it increase our query cost. I came across same scenario in recent time to compare a string based column to just check whether it equals to parameter string value or not and it took 76% of total query cost. SQL SERVER Optimizer hints to create a cover index using Primary Key plus this column which improve query performance by at least 50% but at the same time I came across Hash Key function that satisfied my needs, storage and optimization. So I am going to discuss what is Hash key and how can we implement it using SQL SERVER 2008 and above.I have gathered information from many sources and msdn is one of them.

What is Hash Function


Hash is the value (int or varbinary) result of an algorithm (known as a hash function) applied to a given string. You just need to provide your string as input and you will get a unique hash value as an output. If we provide a complete page string to this function and then change just a character to pass value to it. It will return different values. There is small possibility to repeat same value and this will known as hash collision.

Where can I use Hash Function?

·         Security implementation as encryption of string data.
·         Reduce network traffic for cross DB queries because of small size required to compare instead of string values.
·         Less space requires to store and campare values because it returns int and binary values instead of string characters.
·         Performance increase due to small db types and indexes uses if we implement index on it.
·         Avoid whole string comparisons and requires comparing just int values as checksum.
·         If we create hash column in our DB design along with string columns then it is easy for us to implement joins on these column that will act like string joins as these are hash values of string values.

Careful using Hash Function

·         Hash collision may return more than your expected result set by returning same hash value. For this reason, CheckSum might return more values then you expected but if you want to use this column to identify your column changes then consider HashBytes. When an MD5 hash algorithm is specified, the probability of HashBytes returning the same result for two different inputs is much lower than that of CHECKSUM.
·          
Types of Hash function
  • Hash Keys in Database Design
  • CheckSum()
  • HashBytes
For detail about these functions please go to 

Monday, May 28, 2012

SQL SERVER Express advance features (supported and Unsupported Features)


We don't need to install complete SQL SERVER Engine to build reports SSRS tool, Management tools and other advance features as we do in previous versions.

More detail can be viewed from this link
http://shamas-saeed.blogspot.com/2012/05/sql-server-2008-express-with-advance.html

I got this detail from different sources of msdn linked below.

You can download it from this link
http://www.microsoft.com/en-us/download/details.aspx?id=1842


features supported and unsupported by SSRS 2008 Express with Advance Edition is

SQL Server Express provides the following Reporting Services functionality:
·         On-demand report processing for each user who views a report. When a user opens a report, the report is initialized, the query is processed, data is merged into the report layout, and the report is rendered into a presentation format.
·         Rendering formats are available for HTML, Acrobat, and Excel.
·         Report data sources must be SQL Server relational databases that run locally in SQL Server Express.
·         Report server management and report viewing are supported through Report Manager.
·         Configuration is supported through the Reporting Services Configuration tool.
·         Rs.exe, rsconfig.exe, and rskeymgmt.exe command line utilities are available in SQL Server Express.
·         Windows Authentication and predefined roles are used to map existing group and user accounts to a named collection of operations.
Other editions of SQL Server include a larger set of Reporting Services features. The following list describes the features that are documented in SQL Server Books Online, but cannot be used in this edition:
·         Scheduled report processing, caching, snapshots, subscriptions, and delivery are not supported.
·         Analysis Services, Oracle, XML, SAP, SQL Server Integration Services (SSIS), OLE DB, and ODBC data sources are not supported.
·         Remote data sources are not supported. Reports that are hosted in a SQL Server Express report server must retrieve SQL Server relational data from a local SQL Server Express Database Engine instance.
·         Ad hoc reporting through semantic models and Report Builder is not supported.
·         TIFF (Image), XML, and CSV rendering extensions are not supported.
·         The Reporting Services API extensible platform for delivery, data processing, rendering, and security is not supported.
·         Custom authentication extensions and custom role assignments are not supported. You must map existing Windows domain user and group accounts to predefined role definitions.
·         Custom report items are not supported.
·         Managing a long-running report process is not supported. Specifically, you cannot use the Manage Jobs feature in Report Manager to stop report processing.
·         Scale-out deployment is not supported.
·         SharePoint integrated mode is not supported.
·         Report Builder 2.0 is not supported. Report Builder 2.0 can connect to a SQL Server Express database on the local computer or on a remote report server.


list of Supported features and not Supported features in SQL SERVER Express 2008
http://msdn.microsoft.com/en-us/library/ms365248(v=sql.100).aspx


SQL Server Express supports most of the features and functionality of SQL Server 2008. This includes the following:

Stored procedures
SQL Server Configuration Manager
Views
Replication (as a subscriber only)
Triggers
Advanced Query Optimizer
Cursors
SMO/RMO
sqlcmd and osql utilities
Integration with Visual Studio
Snapshot isolation Levels
Service Broker (as a client only)¹
Native XML support. This includes XQuery and XML schemas
SQL CLR
Transact-SQL language support
Multiple Active Result Sets (MARS)
Dedicated Administrator Connection²
Full text search
Subset of Reporting Services features³
Import/Export Wizard

The following table lists the additional SQL Server 2008 database features that are not supported in this version of SQL Server Express. It also lists database features from earlier versions of SQL Server that are not supported.



SQL Server features not supported in SQL Server Express
SQL Server features from earlier versions not supported in SQL Server Express
Database mirroring
SQL Mail
Online restore
Failover clustering
Database snapshot
Distributed partitioned views
Parallel index operations
VIA protocol support
Mirrored media sets
Log shipping
Partitioning
Parallel DBCC
Address Windowing Extensions (AWE)
Parallel Create Index
Hot-add memory
Enhanced Read Ahead and Scan
Native HTTP SOAP access
Indexed views (materialized views)
SQL Mail and Database Mail
Partitioned views
Online Index Operations
-
SQL Server Agent and SQL Server Agent Service
-