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
A blog for Microsoft Technologeis, Articles, Reviews,Best Practices, Upcoming Microsoft Technologies particulary related to Windows Server System and Azure and related Discussions. The purpose of this blog is to provide a resource to the quick information that Application Developers,Designer and Architects need on Microsoft's Technologies for developing and integrating these technologies. "T H E K N O W L E D G E W H I C H I S C O N C E A L E A D I S L O S T"
Monday, July 23, 2012
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.
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
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
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
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
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);
}
}
}
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.
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.
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.
· 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.
· 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
|
-
|
Friday, May 18, 2012
Except and Intersect in SQL SERVER
Except and Intersect can be used to returns distinct values by comparing the results of two queries.
The basic rules for combining the result sets of two queries that use EXCEPT or INTERSECT are the following:
- The number and the order of the columns must be the same in all queries.
- The data types must be compatible.
- Expressions in parentheses
- The INTERSECT operand
- EXCEPT and UNION evaluated from left to right based on their position in the expression
------------------------------ Code Sample -----------------------------------------
Declare @tbl Table(InstructorID int,CompanyID int,btactive bit,bitprimary bit)
Insert into @tbl values (1,1,1,0),(2,1,1,1),(3,1,1,0),(4,2,1,0),(2,2,1,1),(1,3,1,0)
select * from @tbl
------------------------------ Code Sample -----------------------------------------
Declare @tbl Table(InstructorID int,CompanyID int,btactive bit,bitprimary bit)
Insert into @tbl values (1,1,1,0),(2,1,1,1),(3,1,1,0),(4,2,1,0),(2,2,1,1),(1,3,1,0)
select * from @tbl
I have created a declare table @tbl with four columns and insert some values in it. Now i want to return all those compayIds that are active with bitPrimary = 0 but the result set must not include those companyIds which have bitPrimay= 1 value as well.
If i use simple query to return bitprimary = 0 I got following result
If we look at the results CompanyID 1 and 2 have data against bitPrimary = 0. So according to my requirement i need only to get 3 companyID in my result set. Now look at the use of EXCEPT operator.
EXCEPT:
EXCEPT returns any distinct values from the left query that are not also found on the right query. When an EXCEPT operation is displayed by using the Graphical Showplan feature in SQL Server Management Studio, the operation appears as a left anti semi join.
------------------------------ Code Sample -----------------------------------------
select CompanyID
from @tbl
where btactive = 1 and bitprimary = 0
EXCEPT
select CompanyID
from @tbl
where btactive = 1 and bitprimary = 1
------------------------------ Code Sample -----------------------------------------
look at the pic above. I have attached result set on top right corner which shows CompanyID 3 and this is what exactly I need to get.
We can also get similar results by using EXCEPT -- NOT EXISTS -- NOT IN. But as per many MVPs EXCEPT is best as performance then others.
Now what if i need to get all those compayIds that are active with bitPrimary = 0 but the result set must include those companyIds which have bitPrimay= 1 as well. Now i use INTERSECT
INTERSECT:
INTERSECT returns any distinct values that are returned by both the query on the left and right sides of the INTERSECT operand. When an INTERSECT operation is displayed by using the Graphical Showplan feature in SQL Server Management Studio, the operation appears as a left semi join.
------------------------------ Code Sample -----------------------------------------
select CompanyID
from @tbl
where btactive = 1 and bitprimary = 0
INTERSECT
select CompanyID
from @tbl
where btactive = 1 and bitprimary = 1
------------------------------ Code Sample -----------------------------------------
look at the pic above. Result set shows CompanyID 1 and 2 because both have btPrimary = 0 and 1 but CompanyID 3 does not have btPrimary = 1 so that ommits.
We can also get similar results by using INTERSECT -- LEFT OUTER JOIN -- FULL OUTER JOIN.
Monday, May 14, 2012
BitWise Operators in SQL SERVER
Bitwise operators perform bit manipulations between two expressions of any of the data types of the integer data type category.The operands for bitwise operators can be any one of the data types of the integer or binary string data type categories (except for the image data type)
There are three types of BitWise operators
There are three types of BitWise operators
- & (Bitwise AND)
- ~ (Bitwise NOT)
- | (Bitwise OR)
- ^ (Bitwise Exclusive OR)
For code and further detail about Bitwise operator. Please visit this blog link
http://shamas-saeed.blogspot.com/2012/05/bitwise-operators-in-sql-server.html& (Bitwise AND)
~ (Bitwise NOT)
| (Bitwise OR)
^ (Bitwise Exclusive OR)
..............................................................................
................................................................................\
Labels:
And,
BitWise Operators in SQL SERVER,
Not,
Or,
XOr
Subscribe to:
Posts (Atom)






