Thursday, July 28, 2011

Sql Server 2008 Merge sample

Sql server Merge is a great tool as mentioned in my earlier blog. In this blog, i have a better example of using sql server 2008 merge.

If Not Exists(select * from sys.tables where name = 'TestTable')
Create Table TestTable(Id Int, SerialNo Int, Notes Varchar(50))

Declare @Tbl Table(SerialNo Int, Notes Varchar(50))
begin tran

Insert into TestTable(Id, SerialNo, Notes)
Values(1, 1, 'shouldnot be affected')
Insert into TestTable(Id, SerialNo, Notes)
Values(1, 2, 'shouldnot be affected')


Insert into TestTable(Id, SerialNo, Notes)
Values(2, 1, 'to-delete')
Insert into TestTable(Id, SerialNo, Notes)
Values(2, 2, 'to update')


Insert into @Tbl(SerialNo, Notes)
values(3, 'to insert')

Insert into @Tbl(SerialNo, Notes)
values(2, ' updated value')

select * from TestTable
Declare @Id Int = 2

Merge TestTable as Target
Using @Tbl as Source
On Target.Id = @Id And Target.SerialNo = Source.SerialNo
When Matched Then Update Set Target.Notes = Source.Notes
When Not Matched By Target Then Insert(Id, SerialNo, Notes)
Values(@Id, SerialNo, Notes)
When Not Matched By Source And Target.Id = @Id Then Delete
;

-- all items with id 1 must be present
select * from TestTable
rollback



Wednesday, July 20, 2011

My research articles.

This post consists of articles which I will have to research later. If any one has any interesting things you can mention in the comments.

Simulate windows service in asp.net
http://www.codeproject.com/Articles/12117/Simulate-a-Windows-Service-using-ASP-NET-to-run-sc

.net image resizing
http://www.hanselman.com/blog/NuGetPackageOfWeek11ImageResizerEnablesCleanClearImageResizingInASPNET.aspx
Sql server bulk loading
http://msdn.microsoft.com/en-us/library/dd425070(v=sql.100).aspx
Service broker
http://blogs.msdn.com/b/sql_service_broker/archive/2008/06/26/service-broker-periodic-tasks.aspx
SSRS
http://beyondrelational.com/blogs/viral/archive/2010/07/09/generating-ssrs-reports-programatically.aspx
Sql server optimisation
http://tonesdotnetblog.wordpress.com/2008/05/26/twelve-tips-for-optimising-sql-server-2005-queries/
Asp.net mvc
http://fzysqr.com/2010/04/26/asp-net-mvc2-plugin-architecture-tutorial/
http://www.sharparchitecture.net/
http://weblogs.asp.net/scottgu/archive/2007/06/15/tip-trick-creating-packaged-asp-net-setup-programs-with-vs-2005.aspx
http://www.chrisvandesteeg.nl/2010/11/22/embedding-pre-compiled-razor-views-in-your-dll/
Visual Studio Modelling
http://www.olegsych.com/2010/01/uml-modeling-and-code-generation-in-visual-studio-2010/
Sql Server
CTE
http://msdn.microsoft.com/en-us/library/ms186243.aspx
Visual studio Guidance
http://mikehadlow.blogspot.com/2006/09/how-to-create-guidance-package.html
Todo:
Install ios on win 7
http://ipodtoucher55.blogspot.com/2010/12/installing-ios-sdk-and-xcode-on-windows.html
Javascript library
http://raphaeljs.com/ vector/diagramming javascript
Other:
tortuga.dll

http://oauth.net/code/
https://code.google.com/apis/
http://code.google.com/apis/blogger/docs/2.0/reference.html
http://code.google.com/apis/blogger/docs/2.0/developers_guide_dotnet.html#CreatingAccount

http://www.programmableweb.com/api/blogger/mashups

HARDWARE:
http://www.pikesoft.com/blog/index.php?itemid=124
Email:
http://www.diaryofaninja.com/blog/2011/09/27/what-all-good-web-developers-should-know-about-sending-email?utm_source=feedburner&utm_medium=feed&utm_campaign=Feed%3A+DiaryOfANinja+%28Diary+of+a+Ninja%29
http://www.codinghorror.com/blog/2010/04/so-youd-like-to-send-some-email-through-code.html
sql server
http://www.sqlteam.com/article/using-ddl-triggers-in-sql-server-2005-to-capture-schema-changes
API
http://developer.yahoo.com/travel/
http://developer.bookingmarkets.com/member/register
Use windows live writer to edit our site data
http://www.keyvan.ms/implement-metaweblog-api-in-asp-net
http://www.xml-rpc.net/
http://www.xmlrpc.com/metaWeblogApi
http://www.hanselman.com/blog/TheWeeklySourceCode22CAndVBNETLibrariesToDiggFlickrFacebookYouTubeTwitterLiveServicesGoogleAndOtherWeb20APIs.aspx
ACTS
http://business.ftc.gov/documents/bus61-can-spam-act-compliance-guide-business
Serial Port
http://msmvps.com/blogs/coad/archive/2005/03/23/SerialPort-_2800_RS_2D00_232-Serial-COM-Port_2900_-in-C_2300_-.NET.aspx

Jquery–good articles

http://youhack.me/2010/04/22/live-character-count-with-progress-bar-using-jquery/

http://youhack.me/2011/07/15/google-plus-photo-stack-animation-using-jquery-and-css3/