Sql cursor vs CTE

by iatanasov 11. October 2007 05:18

whith is the best way to grow up with MS SQl Server?

I was doing paging in SQL Server 2000 using Temp Table or Derived Tables. I decided to checkout new function ROW_NUMBER() in SQL Server 2005. ROW_NUMBER() returns the sequential number of a row within a partition of a result set, starting at 1 for the first row in each partition. I have compared both the following query on SQL Server 2005.

SQL 2005 Paging Method

USE AdventureWorksGODECLARE  @StartRow INTDECLARE  @EndRow INTSET    @StartRow = 120SET @EndRow = 140SELECT   
 FirstName, LastName, EmailAddressFROM (SELECT    PC.FirstName, PC.LastName, PC.EmailAddress,ROW_NUMBER()
 OVER(Order BY PC.FirstName, PC.LastName,PC.ContactID) AS RowNumberFROM    Person.Contact PC) PersonContactWHERE  
  RowNumber > @StartRow AND RowNumber < @EndRowORDER BY FirstName, LastName, EmailAddressGO

SQL 2000 Paging Method

USE AdventureWorksGODECLARE  @StartRow INTDECLARE  @EndRow INTSET    @StartRow = 120SET @EndRow = 140CREATE TABLE
 #tables (RowNumber INT IDENTITY(1,1),FirstName VARCHAR(100), LastName VARCHAR(100), EmailAddress VARCHAR(100))
INSERT INTO #tables (FirstName, LastName, EmailAddress)SELECT    PC.FirstName, PC.LastName, PC.EmailAddressFROM   
 Person.Contact PCORDER BY FirstName, LastName, EmailAddressSELECT    FirstName, LastName, EmailAddressFROM   
 #tablesWHERE    RowNumber > @StartRow AND RowNumber < @EndRowDROP TABLE #tablesGO

if you wnat to make your life easiest just use ROW_NUMBE() instead using old temp table( or cursor related solutions).



 

Currently rated 4.0 by 1 people

  • Currently 4/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags:

business | MS SQL

A five-step for writing better project plans

by iatanasov 25. July 2007 01:35

A long time ago, in a lifetime far far away, a client asked me to help their PMO produce useful project plans. Never one to turn away a job, I agreed to speak with him and review the documents his team produced. Leafing though the packet, I found the same things I always find in project plans - lack of coherent planning, no focus on document purpose, and a very limited control of how tasks interact to create workable processes.

The good news, I assured my client, was that he had a lot of company in his situation. The better news was that it’s not that difficult to get out of the psychological rut which leads project managers to create useless project plans, post them, then ignore the hoary artifact in favor of more mutable spreedsheets or calendars.

I prescribed him a simple remedy - four questions I always ask myself before I sit down to wok on a project plan. These questions are as follows.

1) What do you want this project plan to do?

My client’s eye’s crossed when I gave him the first question. “A project plan organizes project work in a reportable fashion” he mumbled, trying to understand what the frak I was saying.

A project plan is, when we get right down to it, a document. Documents exist for a variety of reasons. We use them to record information, to communicate information to one or more audiences, to brainstorm possibilities, or as records of exercises undertaken to understand a problem to name just a few.

The first step to creating a “useful” project plan is to figure out what, in a given context, we need the project plan to convey in order for it to be useful. A project plan written to satisfy auditors must meet very specific criteria which might not have anything to do with actually running a project. A project plan written to aid executive reporting might not contain the information an auditor wants, just as one written to help the project manager actually track multiple interwoven sites will read differently than any of the above.

Trying to write a project plan to cover all “whats” generally leaves the author with a confused, useless mess. Not unlike what I find in organizations all over the country.

2) Who will use this project plan?

My client’s suspicions raised even further when I showed him this one. “Didn’t we answer that in the first question?”

Well, yes and no. When we asked the first question we defined a use and an audience. In this question, we try to dig down and figure out who will interact with the project plan and in what ways. Some of this is contextual. In one organization the PMO may dictate that developers always create and update their own tasks, while another may put all the weight onto the project manager’s shoulders.

I generally create a chart when I try to answer this question. In the first column I put roles and/or names if I know them. In the second column I put in how I expect them to interact with the project plan. In the third I put in how frequently they will interact with it.

3) What will the project plan contain?

“Ummm…” my client said. “Don’t project plans contain tasks, dates, and precursor information?”

By this time, he had pretty much figured out my standard “yes but” answer. Yes, a project plan by convention contains all those things.

However, the real question is what tasks? How do we filter and vet the vast amounts of process information required to run a project into a useful document based on what we need it for and who will interact with it? Do we just drop everything into the project plan and hope someone will get around to updating it? Do we use a very minimalistic, critical path kind of approach. If we do the later, how do we determine what needs to be in the project plan and what doesn’t?

I wish I had a handy trick for making this filter. Unfortunately, this is one of those “technique=time+context+person” things. How we build the filter depends entirely on the answers to the previous two questions along with a host of other process related variables. This is why, I suppose, we have consultants.

4) Why is the project plan important?
“Okay. I get the first three. But this is…” I thought I would cut to the chase, because it looked like my client was about to get a headache.

Every document can be important in at least two contexts - the author’s and the reader’s. It’s vitally important to differentiate between the two, otherwise we end up with yet another confused mess involving poor communication and broken expectations.

For an author, the act of writing the document is often sufficient to organize his thoughts and allow him to move forward. He may never have to revisit the document again to gain benefits from it. We generally call this a success, especially if we see a positive improvement in the author’s productivity or development.

For a given reader, the document is only successful if it meets his expectations about what information he will find. To use this blog as an example, if I titled this article “How to make a great cake”, my gentle readers would justifiably want to flog me. For a project plan, we have to know why a reader feels the document might be important to him. Then, and only then, can we hope to meet his expectations.

Each author can with a little bit of work uncover his own motivations. Uncovering the why of a document in a corporate setting can become unwarrentedly challenging due to politics, lack of focus, and compromises which the author might know nothing about. This situation unfortunately dooms the fledgling project manager, but that’s just the way the world works sometimes.

5) What is deadline of project plan? 

if project plan does't contains exactly defined deadline date, how project manager can maintain the project. Typacaly project plan are writen without final date. Then developer said when i hasn't deadline I will make 

this future tomorrow, why now. In the last week everyone in company fast to complete his tasks, because they all are for last time. If exist project plan with strong defined dates, this problem don't appearance.

Currently rated 4.0 by 1 people

  • Currently 4/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags: ,

business | architecture

Using Web 2.0 for Career Development

by iatanasov 19. July 2007 07:16

Web 2.0

refers to the usage of the World Wide Web as an interactive medium, inviting users to take part in shaping the content of their favorite websites. A few examples include Wikipedia, Myspace, and Del.icio.us. All these sites allow users to create their own content, which then becomes available for everyone to read. Many magazines and newspapers have done articles stating that web 2.0 is the next evolution of the Internet and the Web, and a conscious person will want to take advantage of Web 2.0 for career development and advancement. So what can you do with Web 2.0 to further your career?



One easy way is to use LinkedIn.com’s networking feature. LinkedIn is similar to Myspace and other social networking sites, which allow the user to create a specialized profile detailing their personality. However, LinkedIn is especially focused towards business use, and being “Linked In” could help enormously when you meet and network with other professionals in your field. It also can help when potential employers use the site to search for relevant candidates for a job search they’re performing.


Another possible way is to self-promote by submitting relevant websites to the various Web 2.0 sites that promote sharing of bookmarks and interesting sites, such as del.icio.us and Digg. These sites allow anyone to post a website, which then becomes publicly viewable by all site viewers. As more and more people submit a link to the same post, it becomes more highly rated and easily viewed by people coming to the site. If you are a photographer, for instance, you could submit a link to an amazing photo you took to all the different bookmarking sites, which would broaden exposure to your photography by putting the image in front of a large set of eyes.


A third popular way is to use Myspace’s networking feature. Myspace is a website which allows people to create profiles unique to themselves or their band. Within a Myspace profile, you can select several different job titles as ones you would like to inform people that you are interested in. In this manner, you can start to network with other people who have profiles on Myspace and are also interested in networking about the same job. Myspace is especially valuable simply because so many millions of people use it everyday. 

A commonality between Web 2.0 sites is that the ability to post content is free, and thus is a great place to market yourself and your skill set while still remaining within a specific budget to handle your personal advertising. This is in contrast to traditional methods of promotion, such as direct mail, that have high costs. Therefore if you run your own business, or feel that your name recognition is important, Web 2.0 sites can be invaluable self-promoting mechanisms, both within your industry and across the web.

In summation, Web 2.0 offers someone looking to further their career many different options for enhancing their visibility within a particular industry. Try and submit great content, across a broad range of Web 2.0 sites, and see where the technology revolution takes you!

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags: , ,

web design | web development | business

Powered by BlogEngine.NET 1.1.0.7
Theme by Mads Kristensen

About the author

Ivan Atanasov - web developer
E-mail me Send mail Subscribe Feed

Calendar

<<  July 2008  >>
MoTuWeThFrSaSu
30123456
78910111213
14151617181920
21222324252627
28293031123
45678910

View posts in large calendar

Pages

    Recent posts

    Recent comments

    Authors

    Disclaimer

    The opinions expressed herein are my own personal opinions and do not represent my employer's view in anyway.

    © Copyright 2008 it-coder.com

    Sign in