Friday, October 30, 2009

Applying a SharePoint Designer Workflow to multiple Lists

Applying a SharePoint Designer Workflow to multiple Lists

When using SharePoint Designer to create a workflow you are required to bind the workflow to a particular list:

Wf1

The problem is that you cannot from this interface bind the workflow to other lists.

You might be tempted to use the “Save List as Template” option in the List’s settings, and then create a new list based on this template to create a list that uses the workflow. The problem is that the workflow is still bound to the list from which the new list is based, and an error will probably be generated whenever you try to start an instance of the workflow – the steps will try to reference items etc. in the original list.

In SharePoint Designer you can expand out the files associated with a workflow:

Wf3

The “.xoml.wfconfig.xml” file contains information on the list the workflow is bound to using the List’s ID (a GUID): 


Wf2

The file “.xoml.rules” contains the ‘conditions’ you program for the workflow and the “.xoml” file contains the ‘actions’. The “.aspx” form is displayed when the workflow is started manually.

To re-use a workflow in another list:

  1. Create a new workflow on the new list.
  2. Create at least one step, one condition and one action in this workflow. This ensures that the files shown above are created and they will be replaced by the next operations.
  3. From the original workflow open the .xoml file as XML and copy the entire contents to the clipboard.
  4. Open the .xoml file for the new workflow and replace the entire contents with the copy from (3).
  5. Repeat this operation for the xoml.rules file.
  6. Double click the .xoml file for the new workflow to open the workflow in the Workflow Designer and click Check Workflow to verify no errors and then click Finish to ensure the workflow is saved.


I’ve tested this technique with simple workflows and the process works well.

Thursday, October 29, 2009

Custom Code in Share point Links

Developing Sharepoint Server 2007 Publishing Sites the Smart and Structured Way


Creating a New Silverlight 2 Control for SharePoint 2007


Programming Event Handling in Windows SharePoint Services




Rapidshare link

Rapidshare Search Link

Wednesday, October 28, 2009

How to Use SharePoint Discussion Boar...

How to Use SharePoint Discussion Boards in Outlook 2007


As you can imagine, we are heavy SharePoint users here at SharePoint Solutions. Much of the work we all do every day is done with SharePoint. Unlike our instructors, consultants, and developers, everyone isn't a SharePoint expert. Just like in your own organization, we have many Information Workers. Recently, we've been utilizing SharePoint Discussion Boards more. So I sent an email to our internal staff letting them know they may find these discussion boards easier to use if they connect them to Outlook 2007. In that email, I also included brief directions on how to do the most common tasks. Someone suggested that our blog readers might also be interested in those instructions, so here they are. Enjoy!

How to Connect a SharePoint Discussion Board to Outlook 2007


  1. While viewing a particular discussion board, click on Actions, Connect to Outlook.


  2. Depending on your operating system and how it is configured, you may receive a dialog warning that, "A website wants to open web content using a program on your computer." If you receive this dialog box, click the Allow button.

  3. In Outlook 2007, you will receive a dialog box asking you if want to, "Connect this SharePoint Discussion Board to Outlook?" Click the Yes button.


  4. If you have other SharePoint Discussion Boards you want to connect to Outlook 2007, you will need to repeat steps 1 through 3 for each of them. Each of your users will need to manually connect their discussion boards in this manner—I'm not aware of any way to push this out automatically for them.

How to Read SharePoint Discussion Board Messages with Outlook 2007


  1. After you have connected your SharePoint Discussion Boards to Outlook, you will notice they are now listed in the Mail section of your Outlook Navigation Pane in a folder named SharePoint Lists. Discussion Boards that have messages you haven't yet read will appear in a Bold typeface. This allows you to quickly see where there are items you need to read without having to go to the SharePoint site in a browser. In the example below, you can see that there are no unread messages in Sales Leads Discussion, but there are 4 unread messages in the Sales Training Discussion.


  2. When you click on the name of a particular discussion board in the Outlook Navigation Pane, you will view the message headers in a threaded view in Outlook's List Pane. Individual posts that you haven't read will appear in a Bold typeface in this list. Each conversation will be grouped together and replies will appear indented beneath the item that was replied to. In the screenshot below, you'll notice that everything has been read except for the two items by Gail and Ryan in the conversation on "Great Book: Tribes by Seth Godin." Ryan posted a reply to Gail's initial comment; therefore his reply is indented below it.

  3. Just like reading email, when you click on a particular item in the List Pane, you can read it in the Outlook Preview Pane. You can also double-click on the item in the List Pane to open it in its own window.


How to Reply to a SharePoint Discussion Board Message with Outlook 2007

  1. To reply to a post you are viewing in the Preview Pane, click on the Post Reply button in the Toolbar.


  2. If you have opened a post in its own window, you can reply clicking on the Post Reply button in the Ribbon.


  3. When you click on either of the Post Reply buttons in steps 1 or 2, a new window will open for you to type your message. When you are ready to post your reply to the server, click on the Post button. You will see your post in Outlook, and it will also be posted to the discussion boards in SharePoint as well. Note: To keep things clean and easier to read, I usually delete my signature and the copy of the text to which I am replying. I see no reason to clutter the space with this information. It's a personal choice though, and certainly up for debate, but let's not debate it here. :-)


How to Post a New Message to a SharePoint Discussion Board with Outlook 2007

  1. To create a new post (i.e. start a new conversation that is not a response to a previous discussion), in the Outlook Navigation Pane carefully select the discussion board to which you want to post. It is important that you select the correct discussion board first!
    Then click the New (New Post in this Folder) button in the toolbar.


  2. A new window will open where you can enter the subject for your new post and type the message body. When you are done, click the Post button.


The Next Level with SharePoint Discussion Board Messages in Outlook 2007

As with regular messages in Outlook you can do things like mark posts as read or unread. For the real power users, you can do much more such as create custom views that only show you posts you haven't read yet. Outlook 2007 puts you in full control of your SharePoint discussion board experience. Make it work the way the way that is most efficient and productive for you!


Best Blogs List

How to Use SharePoint Discussion Boards in Outlook 2007

www.sharepoint-tips.com

Tuesday, October 27, 2009

Using DDWRT in xslt-based web parts

What is DDWRT?

well, its a script that microsoft packaged for it's xslt dataviews, that gives them more xslt power.
I needed to use the ddwrt functions in my content query web part, but I guess that the following approach will work in the search web parts as well.

Why do we need it?

I needed it to format the date I was getting back from the content query. The format I was getting back was ugly to the user (2007-06-27 15:52:00) and I wanted to format it, but I didn't want to write my own function.

So how to use it?

you need to add to your xslt the following namespace where the namespaces are declared (at the top of the xsl file, in the "xsl:stylesheet" tag):
xmlns:ddwrt="http://schemas.microsoft.com/WebParts/v2/DataView/runtime"

Then you can use the ddwrt's functions. For example, to format the date I used the following:

Note that in the FormatDate function I used 2 hard coded values - 3081 which is the LCID for Australia (so the date will be formatted to Australian date format) and 5 which specifies the what do I want to display - date, time, date and time ect. I have no idea what values give what, but I do know that 5 gives me the date and the time.

Workaround - "Error" in navigation when creating a publishing site from code

Since I started working with sharepoint 2007 I was puzzled by this bug, and recently I asked more people how said they have that too. The problem happens when you use the API to create a site out of a template that has the publishing feature activated in it. The site is created ok, but the first user to open the site will see a very odd tab and quick-launch:



So far, I have no explanation, but I have a workaround. Make a call to the site in the code. I know - this adds process time and resources, but it beats having your users ask you about the "error tab".
In your code, add the following function, and call it just after the site creation code:

public static void OpenUrl(string url)
{
try
{
HttpWebRequest request = (HttpWebRequest) WebRequest.Create(url);
request.UseDefaultCredentials = true;
HttpWebResponse response = (HttpWebResponse) request.GetResponse();
}
catch(Exception ex) { //do something with the error }}

Here is an example how to use this function:

public static void CreateSite(SPWeb parentWeb)
{
try
{ //get the template for the site using the GetWebTemplate function I wrote
SPWebTemplate template = SharePointFunctions. GetWebTemplate(parentWeb, this.SiteTemplateName,
ConfigVariables.SitesLCID);
//create the site using the class properties
newWeb = parentWeb.Webs.Add(this.ShortName,
this.SiteTitle,
this.SiteDescription,
ConfigVariables.SitesLCID,
template, false, false);
OpenSiteHomePage(newWeb.Url);
}
catch(Exception ex) { //do something with the error }}

Monday, October 26, 2009

Using the SharePoint date control in a web part

After a lot of requests in comments in this blog, I figured this must be very hard to implement. So I tried, and found it quite easy. Here is a code sample of a web part that uses the sharepoint date control

The code is simple - three controls - a DateTimeControl from the Microsoft.SharePoint.WebControls namespace, a button and a text box.
The button has a click event. On click, the event sets the text box to display the date that was selected in the DateTimeControl.


public class DatePickerWebPart : System.Web.UI.WebControls.WebParts.WebPart {
DateTimeControl dtc;
TextBox t;
Button b;

protected override void CreateChildControls()
{
base.CreateChildControls();
dtc = new DateTimeControl();
dtc.ID = "dtc" + this.UniqueID;
this.Controls.Add(dtc);
b = new Button();
b.Text = "Click me to see the date";
this.Controls.Add(b);
b.Click += new EventHandler(b_Click);
t = new TextBox();
this.Controls.Add(t);
}

void b_Click(object sender, EventArgs e)
{
t.Text = dtc.SelectedDate.ToLongDateString();
}
}

Here is the result:

This is the web part when the page first loads


This is the web part when you click on the date picker


This is the web part when you click on the button

Using the SharePoint People Picker

A long time ago (beta2 time) I published a post about the people picker control (MOSS 2007 controls - have a bit of fun with the "people editor" form control!).Lately I had many comments on that post from people who have been having issues getting the value the user selected, and asked for another demo of using the control.So here it is:
The code creates three controls - a PeopleEditor (from the Microsoft.SharePoint.WebControls namespace), a button and a textbox. The button has an click event that itirates over the users picked in the PeopleEditor and writes them to the text box. Simple

public class PeoplePickerWebPart : System.Web.UI.WebControls.WebParts.WebPart
{

PeopleEditor pe;
TextBox t;
Button b;
protected override void CreateChildControls()
{
base.CreateChildControls();
pe = new PeopleEditor();
this.Controls.Add(pe);
b = new Button();
b.Text = "Click me to see the users";
this.Controls.Add(b);
b.Click += new EventHandler(b_Click);
t = new TextBox();
t.TextMode = TextBoxMode.MultiLine;
this.Controls.Add(t);
}
void b_Click(object sender, EventArgs e)
{
foreach(string ent in pe.CommaSeparatedAccounts.Split(','))
{
t.Text += ent + Environment.NewLine;
}
}

Results:The web part as the page loads


The web part does "check names"



The web part after the click of the button

Another simple code snippet - using the user field



When looking at the value that is stored, we can see it is a lookup field - and is stored using the format ID#useraccount. For example:listitem["User Name"]
will have "1#development\ishai"Click on the image below to see it in action in visual studio:

Where does this number come from? well, everytime you create a site in sharepoint, sharepoint creates a list for users. Each user gets an ID in the list, and when you add a user column to a list in that site, it is infact a special case of a lookup column into the users list. So in each site the same user will have a different ID.
So how do we use this field in code?

Get a user from a list item:
To get a user we use the SPFieldUserValue class, which accepts a SPWeb and a string value as parameters. The string value is the value from the list that contains the ID and the account name. Once we have that, we can use the SPFieldUserValue to get information about the user.Example:

using (SPSite site = new SPSite("http://portal"))
{
using (SPWeb web = site.OpenWeb())
{
SPList list = web.Lists["Example For Users"];
SPListItem item = list.Items[0];

SPFieldUserValue userValue = new SPFieldUserValue(web, item["User Name"].ToString());
if (userValue.User.LoginName == web.CurrentUser.LoginName)
{
//do something!
}
}
}

Adding a value to a user field

This is the same, but in reverse. We use the same class (SPFieldUserValue ) and give it the values we want for the user.

{using (SPSite site = new SPSite("http://portal"))
{
using (SPWeb web = site.OpenWeb())
{
SPList list = web.Lists["Example For Users"];
SPListItem item = list.Items[0];

SPFieldUserValue userValue = new SPFieldUserValue(web, web.CurrentUser.ID, web.CurrentUser.LoginName);
item["User Name"] = userValue;
item.Update();
}
}

Code Practices - getting\setting values from\to the lookup and the hyperlink fields

How to get data from a field that is a lookup? how to set data into a field that is a hyperlink?I don't believe I didn't write about this yet. It's so common!
For both cases, sharepoint object model exposes classes to help us get or set the data we want. These are the SPFieldLookupValue and the SPFieldUrlValue.

Example 1: Set the url field of a link

Use the SPFieldUrlValue class to create an object that holds the url to link to, and the title to display:
SPList list = web.Lists["Links"];
SPListItem newLink = list.Items.Add();
SPFieldUrlValue value = new SPFieldUrlValue();
value.Description = "test";
value.Url = "http://www.microsoft.com/sharepoint";
newLink["URL"] = value;
newLink.Update();

Example 2: Get the url field of a link

Use the SPFieldUrlValue class to create an object that gets the url and description:
SPList list = web.Lists["Links"];
SPListItem existingLink = list.Items[0];
SPFieldUrlValue value = new SPFieldUrlValue(existingLink["URL"].ToString());
string linkTitle = value.Description;
string linkURL = value.Url;

Example 3: Set the value of a lookup field for a known title and ID

In the following example I am using SPFieldLookupValue to set the value of a lookup field ("Group Name") to item "Program Operations", whose ID is 14:
SPList list = web.Lists["Branches"];
SPListItem newBranch = list.Items.Add();
newBranch["Title"] = "A New Branch";
SPFieldLookupValue newValue = new SPFieldLookupValue(14,"Program Operations");
newBranch["Group Name"] = newValue;
newBranch.Update();

Example 4: Get the value of a lookup field from an item

Here I am reading the value of the group name field (which is a lookup field in the branches list):
SPList list = web.Lists["Branches"];
SPListItem existingBranch = list.Items[0];
SPFieldLookupValue group = new SPFieldLookupValue(existingBranch["Group Name"].ToString());
int lookedUpItemID = group.LookupId;
string lookedUpItemTitle = group.LookupValue;

Sample event handler to set a field as a pr imary key (enforce no duplicates)

Got this as a request from a reader- how to prevent users from adding items with same titles as ones that already exist in the list. using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.SharePoint;
namespace SPSTIPS.SharePoint.EventHandlers
{
public class TitlePrimaryEventHandler:SPItemEventReceiver
{
const string TITLE_QUERY = @"{0}";
public override void ItemAdding(SPItemEventProperties properties)
{
if (properties.AfterProperties["Title"] != null)
{
//get the title of the new item
string currentTitle = properties.AfterProperties["Title"].ToString();
//get the web site object
using (SPWeb web = properties.OpenWeb())
{
//get the current list
SPList list = web.Lists[properties.ListId];
//query the list to check if there are items with the same title
SPQuery q = new SPQuery();
q.Query = string.Format(TITLE_QUERY, currentTitle);
SPListItemCollection itemsWithSameTitle = list.GetItems(q);
//if there are items, cancel the add, and show an error to the user.
if (itemsWithSameTitle.Count > 0)
{
properties.Cancel = true;
properties.ErrorMessage = "There is already an item with the title \"" + currentTitle + "\ in this list".";
}
}
}
}
}
}

Tuesday, October 6, 2009

Restoring SQL Server 2005 Suspect Database MSDB

Restoring SQL Server 2005 Suspect Database MSDB

I as able to restore my MSDB jobs without creating a new MSDB.
Here is what I have done, probably help them lying in the dark struggling with this kind of issue:

Problem :

My SQL 2005 MSDB database was put into SUSPECT, bcoz of abrupt server boot, that has many Sprocs and Jobs. I have no backup of MSDB, hence there is no way of restoring the backup to re-create MSDB.


Solution:

1. Stop the SQL service > Copy the corrupt MSDB MDF data file (only MDF ) from its location onto a different drive/ location > Start the SQL service > Execute the below SQL query to create a User DB with this available MDF file


CREATE DATABASE User_MSDB ON
(NAME=DFT_MSDB , FILENAME='D:\NonSQLDefaultLocation\msdbdata.mdf') FOR ATTACH_REBUILD_LOG

This will create a User database with all the database files @ 'D:\NonSQLDefaultLocation\'

2. Now, take a backup of this User_MSDB database
BACKUP DATABASE User_MSDB TO DISK='D:\NonSQLDefaultLocation\User_MSDB.Bak'

3. Restore the MSDB database with the backup of User_MSDB , the one we have taken in the 2nd step.
RESTORE DATABASE MSDB

FROM DISK='D:\NonSQLDefaultLocation\DFT_MSDB.BAK'
WITH REPLACE

Whoa...you are back with your MSDB data.
Restoring SQL Server 2005 Suspect Database

I had a SQL Server 2005 database in suspect mode,so i couldn't work on transaction until i repaired,while i am searching on the internet to resolve this problem i found an new Database status called Emergency introduced in SQL Server 2005.

This mode can change the database from Suspect mode to Emergency mode, so that you can retrieve the data in read only mode.

Please follow the following steps to change the database status from suspect to emergency than to it's normal state:


EXEC sp_resetstatus 'DBname'
ALTER DATABASE DBname SET EMERGENCY
DBCC checkdb('DBname')
ALTER DATABASE DBname SET SINGLE_USER WITH ROLLBACK IMMEDIATE
DBCC CheckDB ('DBname', REPAIR_ALLOW_DATA_LOSS)
ALTER DATABASE DBname SET MULTI_USER

I hope that will help you to get your database working

Ex:
ALTER DATABASE "WSS_Content_0dc82740ef0841f5853eec5e8aeffdae" SET EMERGENCY
DBCC checkdb('WSS_Content_0dc82740ef0841f5853eec5e8aeffdae')
ALTER DATABASE "WSS_Content_0dc82740ef0841f5853eec5e8aeffdae" SET SINGLE_USER WITH ROLLBACK IMMEDIATE
DBCC CheckDB ('WSS_Content_0dc82740ef0841f5853eec5e8aeffdae', REPAIR_ALLOW_DATA_LOSS)
ALTER DATABASE "WSS_Content_0dc82740ef0841f5853eec5e8aeffdae" SET MULTI_USER

Monday, October 5, 2009

Excel Services Architecture


Excel Services Architecture

Excel Services is part of Microsoft Office SharePoint Server 2007. Excel Services is built on ASP.NET and Windows SharePoint Services 3.0 technologies. There are three core Excel Services components:

  • Excel Web Access
  • Excel Web Services
  • Excel Calculation Services

Excel Services handles communication among the three components and load-balances the requests made to Excel Calculation Services.

The Excel Web Access, Excel Services, and Excel Calculation Services components can be divided into two major groups: the components on a front-end server (also known as the "Web front end"), and the component on a back-end application server.

Excel Services architecture

Excel Web Access

Excel Web Access is an Excel Services Web Part in Office SharePoint Server 2007 that renders (in other words, creates the HTML for) live Excel workbooks on a Web page, and allows the user to interact with those workbooks and explore them. Excel Web Access is the visible Excel Services component for the user. You can use Excel Web Access like any other Web Part in Office SharePoint Server 2007. Excel Web Access does not require anything to be installed on the user's client computer.

The Excel Web Access Web Part properties are also customizable. For more information, see the Microsoft.Office.Excel.Server.WebUI namespace reference documentation.

Excel Web Services

Excel Web Services is the Excel Services component that provides programmatic access to its Web service. You can develop applications that call Excel Web Services to calculate, set, and extract values from workbooks, as well as refresh external data connections. Using Excel Web Services, you can incorporate server-side workbook logic into an application, automate the updating of Excel workbooks and create application-specific user interfaces around server-side Excel calculation.

NoteNote:

When you make changes to a workbook—for example, by setting values to a range using Excel Web Services—the changes to the workbook are preserved only for that particular session. The changes are not saved or persisted back to the original workbook. When the current workbook session ends (for example, when you call the CloseWorkbook method, or the session times out), whatever changes you made will be lost.

If you want to save changes you make to a workbook, you can use the GetWorkbook method and then save the workbook using the API of the destination file store. For more information, see How to: Get an Entire Workbook or a Snapshot and How to: Save a Workbook.

For more information about Excel Web Services, see Excel Services Development Roadmap and the Microsoft.Office.Excel.Server.Webservices and Microsoft.Office.Excel.Server namespaces reference documentation.

Excel Calculation Services


The role of Excel Calculation Services is to load workbooks, calculate them, call custom code (user-defined functions) and refresh external data. It also maintains the session state for interactivity. Excel Calculation Services maintains a session for the duration of interactions with the same workbook by a user or caller. A session is closed when the caller explicitly closes it or when the session times out on the server. Excel Services caches the opened Excel workbooks, calculation states, and external data query results, for improved performance when multiple users access the same set of workbooks.

Load-Balancing

In multiple-server configurations, Excel Services load-balances requests across multiple Excel Calculation Services occurrences in a farm configuration. If your installation includes multiple application servers, Excel Services will balance the load to ensure that no single application server is overloaded by request


SQL Interview Question

  1. What is normalization? - Well a relational database is basically composed of tables that contain related data. So the Process of organizing this data into tables is actually referred to as normalization.
  2. What is a Stored Procedure? - Its nothing but a set of T-SQL statements combined to perform a single task of several tasks. Its basically like a Macro so when you invoke the Stored procedure, you actually run a set of statements.
  3. Can you give an example of Stored Procedure? - sp_helpdb , sp_who2, sp_renamedb are a set of system defined stored procedures. We can also have user defined stored procedures which can be called in similar way.
  4. What is a trigger? - Triggers are basically used to implement business rules. Triggers is also similar to stored procedures. The difference is that it can be activated when data is added or edited or deleted from a table in a database.
  5. What is a view? - If we have several tables in a db and we want to view only specific columns from specific tables we can go for views. It would also suffice the needs of security some times allowing specfic users to see only specific columns based on the permission that we can configure on the view. Views also reduce the effort that is required for writing queries to access specific columns every time.
  6. What is an Index? - When queries are run against a db, an index on that db basically helps in the way the data is sorted to process the query for faster and data retrievals are much faster when we have an index.
  7. What are the types of indexes available with SQL Server? - There are basically two types of indexes that we use with the SQL Server. Clustered and the Non-Clustered.
  8. What is the basic difference between clustered and a non-clustered index? - The difference is that, Clustered index is unique for any given table and we can have only one clustered index on a table. The leaf level of a clustered index is the actual data and the data is resorted in case of clustered index. Whereas in case of non-clustered index the leaf level is actually a pointer to the data in rows so we can have as many non-clustered indexes as we can on the db.
  9. What are cursors? - Well cursors help us to do an operation on a set of data that we retreive by commands such as Select columns from table. For example : If we have duplicate records in a table we can remove it by declaring a cursor which would check the records during retreival one by one and remove rows which have duplicate values.
  10. When do we use the UPDATE_STATISTICS command? - This command is basically used when we do a large processing of data. If we do a large amount of deletions any modification or Bulk Copy into the tables, we need to basically update the indexes to take these changes into account. UPDATE_STATISTICS updates the indexes on these tables accordingly.
  11. Which TCP/IP port does SQL Server run on? - SQL Server runs on port 1433 but we can also change it for better security.
  12. From where can you change the default port? - From the Network Utility TCP/IP properties –> Port number.both on client and the server.
  13. Can you tell me the difference between DELETE & TRUNCATE commands? - Delete command removes the rows from a table based on the condition that we provide with a WHERE clause. Truncate will actually remove all the rows from a table and there will be no data in the table after we run the truncate command.
  14. Can we use Truncate command on a table which is referenced by FOREIGN KEY? - No. We cannot use Truncate command on a table with Foreign Key because of referential integrity.
  15. What is the use of DBCC commands? - DBCC stands for database consistency checker. We use these commands to check the consistency of the databases, i.e., maintenance, validation task and status checks.
  16. Can you give me some DBCC command options?(Database consistency check) - DBCC CHECKDB - Ensures that tables in the db and the indexes are correctly linked.and DBCC CHECKALLOC - To check that all pages in a db are correctly allocated. DBCC SQLPERF - It gives report on current usage of transaction log in percentage. DBCC CHECKFILEGROUP - Checks all tables file group for any damage.
  17. What command do we use to rename a db? - sp_renamedb ‘oldname’ , ‘newname’
  18. Well sometimes sp_reanmedb may not work you know because if some one is using the db it will not accept this command so what do you think you can do in such cases? - In such cases we can first bring to db to single user using sp_dboptions and then we can rename that db and then we can rerun the sp_dboptions command to remove the single user mode.
  19. What is the difference between a HAVING CLAUSE and a WHERE CLAUSE? - Having Clause is basically used only with the GROUP BY function in a query. WHERE Clause is applied to each row before they are part of the GROUP BY function in a query.
  20. What do you mean by COLLATION? - Collation is basically the sort order. There are three types of sort order Dictionary case sensitive, Dictonary - case insensitive and Binary.
  21. What is a Join in SQL Server? - Join actually puts data from two or more tables into a single result set.
  22. Can you explain the types of Joins that we can have with Sql Server? - There are three types of joins: Inner Join, Outer Join, Cross Join
  23. When do you use SQL Profiler? - SQL Profiler utility allows us to basically track connections to the SQL Server and also determine activities such as which SQL Scripts are running, failed jobs etc..
  24. What is a Linked Server? - Linked Servers is a concept in SQL Server by which we can add other SQL Server to a Group and query both the SQL Server dbs using T-SQL Statements.
  25. Can you link only other SQL Servers or any database servers such as Oracle? - We can link any server provided we have the OLE-DB provider from Microsoft to allow a link. For Oracle we have a OLE-DB provider for oracle that microsoft provides to add it as a linked server to the sql server group.
  26. Which stored procedure will you be running to add a linked server? - sp_addlinkedserver, sp_addlinkedsrvlogin
  27. What are the OS services that the SQL Server installation adds? - MS SQL SERVER SERVICE, SQL AGENT SERVICE, DTC (Distribution transac co-ordinator)
  28. Can you explain the role of each service? - SQL SERVER - is for running the databases SQL AGENT - is for automation such as Jobs, DB Maintanance, Backups DTC - Is for linking and connecting to other SQL Servers
  29. How do you troubleshoot SQL Server if its running very slow? - First check the processor and memory usage to see that processor is not above 80% utilization and memory not above 40-45% utilization then check the disk utilization using Performance Monitor, Secondly, use SQL Profiler to check for the users and current SQL activities and jobs running which might be a problem. Third would be to run UPDATE_STATISTICS command to update the indexes
  30. Lets say due to N/W or Security issues client is not able to connect to server or vice versa. How do you troubleshoot? - First I will look to ensure that port settings are proper on server and client Network utility for connections. ODBC is properly configured at client end for connection ——Makepipe & readpipe are utilities to check for connection. Makepipe is run on Server and readpipe on client to check for any connection issues.
  31. What are the authentication modes in SQL Server? - Windows mode and mixed mode (SQL & Windows).