Sunday, January 19, 2014

Join two tables in Update statement [T-SQL]

Two tables can be easily joined during an update, similar to a join used in a select statement. This comes in handy specially when one table needs to be updated based on a condition in another table. Below is one such example.

UPDATE C

SET C.permanentAddress='#000, Marine Drive, Galle, Sri Lanka'

FROM Customer AS C INNER JOIN users AS U

ON U.userId = C.customerId

WHERE U.loginName LIKE('%ashaamil%')


That's pretty much about it !

Saturday, January 18, 2014

SharePoint Web Parts Maintenance Page

SharePoint web part maintenance pages allows to manage (reset, delete) the web parts embedded into a particular page. It's useful in situations where its required to remove any web parts from a page which has caused a page crash.

For an instance if the page urls is:
http://localhost:1000/SitePages/Home.aspx

you can get the maintenance page by typing in "?contents=1" at the end of the URL string. Below is a sample:

http://localhost:1000/SitePages/Home.aspx?contents=1

This works the same in  SharePoint 2007, 2010 and 2013