SharePoint4us

Explore the Experience in SharePoint 2013

Friday, March 20, 2015

what is stored procedure and how to write and execute a Stored Procedure in SQL Server ?

No comments


Hi Friends,

Thanks for visiting my posts,

In this Post , i would like to post about stored procedure in SQL Server.

1.What is stored procedure ?
2. How to Create a stored procedure ?
3. How to Execute a stored procedure ?


 stored procedure 

A stored procedure is a group of sql statements that has been created and stored in the database. Stored procedure will accept input parameters so that a single procedure can be used over the network by several clients using different input data. Stored procedure will reduce network traffic and increase the performance. If we modify stored procedure all the clients will get the updated stored procedure.


 How to Create a stored procedure ?

1. Open Run-->SSMS( SQL Management Studio will get open).

2.   Select the Database and Select the Table on which  you want to write the   
        SP(store Procedure).

3.     In  our case , Database is SAMPLED and Table name is EmpData.
                   


4.    Put Some data into the table.

    
5.    Select New Query  from the ribbon.

 6 . The above screen tells that we have created a SP for  retrieving the table data .

 7 . After creating the Stored Procedure  click on "Execute" in the Ribbon.



How to execute a stored procedure ?

        
 1.  EXEC SP_Name  and execute , you will fetch the data from table 
 



 This is how we create a stored procedure and
  executes a stored procedure.






Advantages of using stored procedures

a)    a) Stored procedure allows modular programming. 

You can create the procedure once, store it in the database, and call it any number of times in your program. 

b)    b) Stored Procedure allows faster execution. 

If the operation requires a large amount of SQL code is performed repetitively, stored procedures can be faster. They are parsed and optimized when they are first executed, and a compiled version of the stored procedure remains in memory cache for later use. This means the stored procedure does not need to be reparsed and reoptimized with each use resulting in much faster execution times. 

c)     c) Stored Procedure can reduce network traffic. 

An operation requiring hundreds of lines of Transact-SQL code can be performed through a single statement that executes the code in a procedure, rather than by sending hundreds of lines of code over the network.

d)    d) Stored procedures provide better security to your data

Users can be granted permission to execute a stored procedure even if they do not have permission to execute the procedure's statements directly.

In SQL we are having different types of stored procedures are there

a)    System Stored Procedures
b)    User Defined Stored procedures
c)    Extended Stored Procedures

System Stored Procedures:

System stored procedures are stored in the master database and these are starts with a sp_ prefix. These procedures can be used to perform variety of tasks to support sql server functions for external application calls in the system tables 

Ex: sp_helptext [StoredProcedure_Name]

User Defined Stored Procedures:

User Defined stored procedures are usually stored in a user database and are typically designed to complete the tasks in the user database. While coding these procedures don’t use sp_ prefix because if we use the sp_ prefix first it will check master database then it comes to user defined database

Extended Stored Procedures:

Extended stored procedures are the procedures that call functions from DLL files. Now a day’s extended stored procedures are depreciated for that reason it would be better to avoid using of Extended Stored procedures. 


Hope this blog helps you..... 



Wednesday, March 18, 2015

What is Content Type Hub and How to Configure in SharePoint 2013 ?

1 comment



Hi Friends,

Thanks for visiting my Posts,

 In this Post , I would like to describe about Content Type Hub



1. What is Content Type Hub ?
2. What is the Purpose of it ?
3. How to Configure the Content Type  Hub ? 
4. Content Type Hub FAQ and Limitations ?

 Content Type Hub

The site collection, which will host content types for sharing, is known as content type hub.

Content Type Hub is a centralized location where we manage and publish content types to other web applications.

  • Content Type Hub is actually a Site Collection.

  • Content Type is published and subscribed using the Managed Metadata Service application.

 

Content Type Syndication Feature

Content Type Syndication is new feature that is part of the Managed Metadata service in SharePoint 2010. It solves a long-standing problem from SharePoint 2007, which is how do I create an enterprise library of content types and synchronize them amongst many different site coll.


What is the Purpose of it ?

Say for example you have a Site Collection Web Application1 and you have created a series of content types to use. Now, you create Web Application2 and find the necessity to reuse the content types created in Web Application 1. There is no way you could share or reference those content types created in Web Application1 in Web Application2. The only way possible is to create or write an application which would install those content types. This situation is pretty common in large organizations. This can be even considered for exposing base content types you use across multiple web applications in the farm.
Introduced in SharePoint 2010

SharePoint 2010 now introduces a new feature called Content Type Hubs. Content Type Hub is a central location where you can manage and publish your content types – so now web applications can subscribe to this hub and pull down the published content types from the hub. Even receive updates on the published content types!



How to Configure the Content Type Hub?
Let us see, how to use the content type hub in SharePoint 2013.
Let us see that with step by step procedures.
1. Let us create our SiteCollection for the Content Type Hub
                                        Create Site Collection

We need to give this Site Collection Url in Managed meta data Serivces Central AdminàManage Service ApplicationàSelect Managed Meta Data Services and Click on Properties


         Give your Site Collection URL in Content Type Hub.





Once its created, Click on Site SettingsàManage Site Collection Features.


Activate Content Type Syndication Hub feature

                     Create Site Columns



You  can see the created Site Columns 


  Now Create a new content Type  add these Site Columns to It


   Add Existing Site Columns

Click on Manage publishing for this content type and Select Publish and click ok 
Note: This Link only gets enabled if we activate Content Type Syndication Feature.


Click it Manage publishing for this content type and Select Republish and click ok

Now go to Site Setting à Under Site Collection Administration àContent Type Publishing.


You can see the published content types here.


 If you are not able to see that immediately, there is a timer job which needs to run. This timer is configured as Hourly basis by default. We can execute this time manually also. The timer is “Content Type Subscriber”. 


Create new Site Collection or  Web Application   Goto Site Settings  Site Content Types


This is the way of Configuring the Content Hub

Below are some of the limitations/FAQ about content type hubs:


1. Which field types are supported? Custom fields and external data columns are not supported(you cannot create external data columns in the content type gallery).
 
2. What happens if a web application is member of two different Content Type Hubs? The default Managed Metadata Service(MMS) gets the priority and will be your content type hub. However, if you customize the service application associations for the web application, you can select the appropriate MMS application proxy for the content type hub.
3. What happens if a user changing a synchronized Content Type inside the Target Site Collection? The subscribed content types are marked 'read only' in the target site collection. Users are unable to manage/change the synchronized content types inside the target site collection. Changes to the content type should always be made in the content type hub and republihsed to push the changes to the subscribed sites.
4. What happens with content types within the sub-site structure? 
Content type subscription is a site collection level feature, so you consume the content types in the top root web and it flows down the sub-sites.
5. Are Workflows supported and if yes what are the limitations? Unfortunately workflows are not supported. However, once you have your content type published to the target site collection, you can create and associate workflows to the subscribed content types in the target site.
Update:  on associating workflows with published content types. As always, you are able to still create list workflows in the target site collection instead of associating with the content type if required.
 
6. What happens with document templates? Document templates associated with the content type are also published along with the subscribed content type.
 
7. What happens with Document Set content Types? Yes, you can subscribe to document set content types. In this case, all the dependent content types with the document set & the document set itself will be published to the target site. However, you should have the Document set feature activated in the target site.
8. What about feature dependencies? Feature dependencies are not activated automatically in the target site collection. Thus, they need to be activated manually before the subscription process, else the content type publishing job will fail in the target site collection for that subscribed content type. Best example is when you subscribe to document set content types
Thanks