Posts

XML Datatype Method – Query()

The Query() method is used to query the XML data using XQuery Expression The Syntax is query ('XQuery') The below shows how to display the xml node where jobid is 1 SELECT JobHistory.query('/Job[@JobID=1]') FROM Employee The below shows how to display the company name node where jobid is 1 SELECT JobHistory.query('/Job[@JobID=1]/CompanyName/text()') FROM Employee

XML Datatype Methods

We can use the xml data type methods to modify/query an XML stored in a column of xml datatype. The methods are as follows 1. Modify() 2. Value() 3. Query() 4. Exist() 5. Nodes() Today, we will see the use of Modify() method The Modify() method is used to modify parts of the XML data in the XML column using XQuery Expression The Syntax is modify (XML_DML) The below example shows to add one more job node to the xml UPDATE Employee SET JobHistory.modify( 'insert News Corp 1 after (/Job)[1]') WHERE EMPLOYEEID = 1 The below example shows to replace a value in the xml node. UPDATE Employee SET JobHistory.modify( 'replace value of (/Job/@JobID)[1] with 3') WHERE EMPLOYEEID = 1 UPDATE Employee SET JobHistory.modify( 'replace value of (/Job/CompanyName/text())[1] with "BBC Corp"') WHERE EMPLOYEEID = 1 The below example shows to delete a node in the xml UPDATE Employee SET JobHistory.modify( 'delete (/Job[@JobID=3])') WHERE EMPLOYEEID = 1

Using XML Datatype is SQL SERVER

The xml data type lets you store XML documents and fragments in a SQL Server database.  The below shows how to add a new column of XML datatype ALTER TABLE Employee ADD JobHistory XML The below shows how to Store the data in a XML column UPDATE Employee SET JobHistory= ' ABC Corp 1 ' WHERE EMPLOYEEID = 1

Use of sp_executesql

The "sp_executesql" is used for executing the sql statements that are build dynamically with or without parameters. The below example shows how to execute by dynamically passing the employee id. DECLARE @EmployeeNumber int; DECLARE @SQLString nvarchar(500); DECLARE @Parameter nvarchar(500); SET @SQLString = 'SELECT * FROM EMPLOYEE WHERE EMPLOYEEID = @EmployeeID'; SET @Parameter = '@EmployeeID int'; SET @EmployeeNumber = 2; EXECUTE sp_executesql @SQLString, @Parameter, @EmployeeID = @EmployeeNumber;

Dynamic SQL in SQL Server - Introduction

Dynamic SQL is nothing but SQL query that is generated programmatically. For example, we can get records of any table using the below Stored Procedure which implements Dynamic SQL CREATE PROC GETDETAILSBYTABLENAME(@TableName varchar(50)) AS BEGIN Declare @SQLQuery VarChar(5000) SELECT @SQLQuery = 'SELECT * FROM ' + @TableName Exec ( @SQLQuery) END

SSRS with XML as Data Source - An Option

I am sure we commonly use SQL SERVER Reporting Services(SSRS)using the Data Source as the database. But if we have think to use XML, then one of the options to use the XML would be to host the XML's in a virtual directory in IIS. Then access the same as a connection string in SSRS. We can think of various options as well.

HTML 5 Feature

We used to always close the tags like for eg: Now in HTML 5 we can even write without closing tags

Office 365

Check out the new Office 365 which is flexible and easy in creating documents , maintaining calendar, emails. It is all managed my microsoft, which means it can be accessed from anywhere. It offers the pay as you go service. For more details read here http://www.microsoft.com/en-in/office365/online-software.aspx To know how it work click here http://www.microsoft.com/en-in/office365/online-software.aspx

New Structural Elements in HTML 5

The new structural elements in HTML 5 are 1. - This is the header which may contain the introduction for a page or a section. 2. - This is reserved for the sections or pages that has links to other pages. 3. - This is the generic document , more like the . 4. - This represent the main content area of the page. 5. - This can be referred to as the side bar of the page, where we usual have some about information, tags etc. 6. - This adds the footer information for the page. Hope this gives an idea on the structural elements in HTML 5.

Good Article - tips for getting more done in fewer hours

Came across this good article.. Read through http://gigaom.com/collaboration/7-tips-for-getting-more-done-in-fewer-hours/

Posting blog entries to Facebook

I use the application RSS Graffiti to post my blogs to Facebook. Here goes the first one :) ... More to come soon.

Running 32-bit application on a 64bit OS IIS 7

When we try to run a 32 bit application hosted on a 64bit OS IIS, it will throw an error that 32 bit application cannot be run. To execute the same go the Application Pool and select the advanced settings on the pool where your application is running. Then change the property "Enable 32-Bit Application" to "True". Bingo.. the application will start working.

Moved to 64-bit Windows 7

Moving from a 32 bit to 64 bit Windows 7 OS was a real shift. I had always been using a 32 bit. But for something that i noticed is that even we have a 4 GB RAM, the memory that was usable was ~2.9GB hence my application was getting slower. I could not even debug. When i shifted to 64 bit , I could see that the memory usable is now 3.8 GB. This was a great boost for performance. I see a lot of change in the way the memory is being used. More to explore.. will keep updating on this in future blog.

Page.RegisterStartupScript not working ??

I am sure many has gone through this where Page.RegisterStartupScript is not working. There are a couple of reasons, they are 1. If the page's form has no "runat=server" 2. If there is a update panel. This can be overcome by using ScriptManager.RegisterStartupScript 3. If there is someother javascript on the page.init Also the Page.RegisterStartupScript is obsolete, start using ClientScript.RegisterStartupScript Happy Coding....

HTML 5 - A First Look

This is been a buzz word these days HTML 5. I keep hearing from people that we should use HTML 5 . Is this just a new buzzword in the internet community or is it something new that will change the way we see web ????? Well….. lets discuss on the same. HTML 5 is the new new version of the Hyper Text Markup Language which is the standard language used for displaying contents with styles. The new HTML 5 brings in new elements and attributes to display modern capabilities on the websites. HTML 5 brings in backward compatibility which helps parsing of older versions of HTML. HTML 5 is no longer based on Standard Generalized Markup Language (SGML). It has the new DOCTYPE which is We will see more on this soon……

When to Tweet …….

I came across this good site www.whentotweet.com . This sites lets you know when is the best time for you to tweet. Have fun tweeting at the time prescribed :)

Trust in God..

Trusting in God is the way of life. Many people think that they achieve everything because of there might, ability and strength. I feel that whatever happens in your life is because of God’s will. We have to always keep our trust in God and everything in our life will happen at God’s time. Even at whatever urgency we show to get something done it may not succeed because we need Gods grace and only at his time it will come to pass. Every morning we should wake up with prayers and present before God the needs of your life. God will meet our desires at the appropriate time. We need to have patience and wait upon him till it comes to pass. Above all we should thank him for that he has done in our life. In all situation may be good or in worst situation we should seek his face and he will never let you down. For the instance you may feel why this is happening to you but very soon he will lift you up in front of the same people to higher places. He is an awesome god. I have personally felt a...

One more year passed by - Happy Birthday

Getting older by one more year :) . yep. guessed it right.. it was my birthday yesterday. Spend the morning in church for fasting and prayer. It was awesome in the presence of God. At church we had Rev. Alwin Thomas (Ruah Ministries) and we had a good time of fellowship with our Lord and Saviour Jesus Christ. Lot of friends wished me and many wishes over email, SMS and facebook. Hope to have a great year ahead...... Cheers!!!

Happy New Year 2011

Its New Year 2011 that's 1/1/11 ...wow.. 2010 has passed by , a year filled with all ups and downs but truely the almighty God took care at all times. The promise for the year 2011 is "BE FRUITFUL" Genesis 28:3, I am sure this year is going to be fruitful by walking with presence of God. I am sure last year i was better in updating my blog.. Hope to better it this year. Wishing all a Happy and Prosperous NEW YEAR 2011.

ASP.NET 4.0 Feature - ClientIDMode Property

Let us see the new feature in ASP.NET 4.0 known as “ClientIDMode Property”. In the past we have seen that client id for any controls begin with “ctl00” and it always used to be a long names for eg: “gvBooks_ctl01_lnkOrderBook” . These id’s were very much needed when we used to while writing validations in javascript. Now in ASP.NET 4.0 we have the ClientIDMode Property which supports four different options as follows 1. AutoID – This is nothing but same as what we had prior to .NET 4.0 2. Predictable – This means that it concatenates the control name with the container (may be a contentplaceholder) for eg: contentplacholder1_btnSave 3. Static - This means that whatever the ID is set for the controls it uses that itself. 4. Inherit – This means that it will inherit the ClientIDMode property setting of the parent control. This is used in the different ways as seen below 1. It can be set in the web.config as <pages clientIDMode="Static"/> 2. It can be set at the control...