Search Results

Search found 33509 results on 1341 pages for 'good practices'.

Page 27/1341 | < Previous Page | 23 24 25 26 27 28 29 30 31 32 33 34  | Next Page >

  • SQL SERVER – UNION ALL and ORDER BY – How to Order Table Separately While Using UNION ALL

    - by pinaldave
    I often see developers trying following syntax while using ORDER BY. SELECT Columns FROM TABLE1 ORDER BY Columns UNION ALL SELECT Columns FROM TABLE2 ORDER BY Columns However the above query will return following error. Msg 156, Level 15, State 1, Line 5 Incorrect syntax near the keyword ‘ORDER’. It is not possible to use two different ORDER BY in the UNION statement. UNION returns single resultsetand as per the Logical Query Processing Phases. However, if your requirement is such that you want your top and bottom query of the UNION resultset independently sorted but in the same resultset you can add an additional static column and order by that column. Let us re-create the same scenario. First create two tables and populated with sample data. USE tempdb GO -- Create table CREATE TABLE t1 (ID INT, Col1 VARCHAR(100)); CREATE TABLE t2 (ID INT, Col1 VARCHAR(100)); GO -- Sample Data Build INSERT INTO t1 (ID, Col1) SELECT 1, 'Col1-t1' UNION ALL SELECT 2, 'Col2-t1' UNION ALL SELECT 3, 'Col3-t1'; INSERT INTO t2 (ID, Col1) SELECT 3, 'Col1-t2' UNION ALL SELECT 2, 'Col2-t2' UNION ALL SELECT 1, 'Col3-t2'; GO If we SELECT the data from both the table using UNION ALL . -- SELECT without ORDER BY SELECT ID, Col1 FROM t1 UNION ALL SELECT ID, Col1 FROM t2 GO We will get the data in following order. However, our requirement is to get data in following order. If we need data ordered by Column1 we can ORDER the resultset ordered by Column1. -- SELECT with ORDER BY SELECT ID, Col1 FROM t1 UNION ALL SELECT ID, Col1 FROM t2 ORDER BY ID GO Now to get the data in independently sorted in UNION ALL let us add additional column OrderKey and use ORDER BY  on that column. I think the description does not do proper justice let us see the example here. -- SELECT with ORDER BY - with ORDER KEY SELECT ID, Col1, 'id1' OrderKey FROM t1 UNION ALL SELECT ID, Col1, 'id2' OrderKey FROM t2 ORDER BY OrderKey, ID GO The above query will give the desired result. Now do not forget to clean up the database by running the following script. -- Clean up DROP TABLE t1; DROP TABLE t2; GO Here is the complete script used in this example. USE tempdb GO -- Create table CREATE TABLE t1 (ID INT, Col1 VARCHAR(100)); CREATE TABLE t2 (ID INT, Col1 VARCHAR(100)); GO -- Sample Data Build INSERT INTO t1 (ID, Col1) SELECT 1, 'Col1-t1' UNION ALL SELECT 2, 'Col2-t1' UNION ALL SELECT 3, 'Col3-t1'; INSERT INTO t2 (ID, Col1) SELECT 3, 'Col1-t2' UNION ALL SELECT 2, 'Col2-t2' UNION ALL SELECT 1, 'Col3-t2'; GO -- SELECT without ORDER BY SELECT ID, Col1 FROM t1 UNION ALL SELECT ID, Col1 FROM t2 GO -- SELECT with ORDER BY SELECT ID, Col1 FROM t1 UNION ALL SELECT ID, Col1 FROM t2 ORDER BY ID GO -- SELECT with ORDER BY - with ORDER KEY SELECT ID, Col1, 'id1' OrderKey FROM t1 UNION ALL SELECT ID, Col1, 'id2' OrderKey FROM t2 ORDER BY OrderKey, ID GO -- Clean up DROP TABLE t1; DROP TABLE t2; GO I am sure there are many more ways to achieve this, what method would you use if you have to face the similar situation? Reference: Pinal Dave (http://blog.sqlauthority.com)   Filed under: Best Practices, PostADay, SQL, SQL Authority, SQL Query, SQL Server, SQL Tips and Tricks, T SQL, Technology

    Read the article

  • Laptops or Notebooks in a meeting? [closed]

    - by greengit
    Is taking the laptop to the meeting a good idea? Of course, the project leader needs to have one -- but the programmers -- especially those who only need to get straight instructions on what to do next on the project -- do they need to take laptops? I feel it takes longer to save notes in a software -- and it's lot easier to just jot down "things to do" in a simple note book. That way you can keep up with the discussion and not lose track of what someone else is saying by spending too much time entering text in the machine.

    Read the article

  • Software Design for Product Verticals and Service Verticals

    - by Rachel
    In every industry there are two verticals Product Vertical and Service Vertical, so my question is: How does design approach changes while designing Software for Product Vertical as compared to developing Software for Service Vertical ? What are the pros and cons for each case ? Also, in case of Product Vertical, How you go about designing Product or Features and what are steps involved ? Lastly, I was reading How Facebook Ships Code article and it appears that Product Managers have very little influence on how Product is developed and responsibility lies mainly with the Developer for the feature. So is this good practice and why one would go for this approach ? What would be your comment on this kind of approach ?

    Read the article

  • Returning a mock object from a mock object

    - by Songo
    I'm trying to return an object when mocking a parser class. This is the test code using PHPUnit 3.7 //set up the result object that I want to be returned from the call to parse method $parserResult= new ParserResult(); $parserResult->setSegment('some string'); //set up the stub Parser object $stubParser=$this->getMock('Parser'); $stubParser->expects($this->any()) ->method('parse') ->will($this->returnValue($parserResult)); //injecting the stub to my client class $fileHeaderParser= new FileWriter($stubParser); $output=$fileParser->writeStringToFile(); Inside my writeStringToFile() method I'm using $parserResult like this: writeStringToFile(){ //Some code... $parserResult=$parser->parse(); $segment=$parserResult->getSegment();//that's why I set the segment in the test. } Should I mock ParserResult in the first place, so that the mock returns a mock? Is it good design for mocks to return mocks? Is there a better approach to do this all?!

    Read the article

  • Tips or techniques to use when you do't know how to code something?

    - by janoChen
    I have a background as UI designer. And I realized that it is a bit hard for me to write a pieces of logic. Sometimes I get it right, but most of the time, I end up with something hacky (and it usually takes a lot of time). And is not that I don't like programming, in fact, I'm starting to like it as much as design. It's just that sometimes I think that I'm better at dealing with colors an shapes, rather than numbers and logic (but I want to change that). What I usually do is to search the solution on the Internet, copy the example, and insert it into my app (I know this is not a very good practice). I've heard that one tip was to write the logic in common English as comment before writing the actual code. What other tips and techniques I can use?

    Read the article

  • Back in Atlanta! Wed, Feb 9 2011

    - by KKline
    I always enjoy spending time with my friends from Atlanta, as well as meeting folks and making new friends. If you live in the Atlanta area, I hope you'll join me on the evening of Wednesday, February 9th, 2011. Details are at the Atlanta SQL Server user group website . It's common knowledge that I have a terrible memory for many things. However, one of the few things that my memory is usually really good at is remember names & faces (and remembering stories, but that is another story as well)....(read more)

    Read the article

  • Which programming language should I learn? [on hold]

    - by Ashkan
    I'm Ashkan and I'm from Iran, I started programming when I was 13 and I learned a lot of stuff since then, But now I'm totally lost. Since I live in Iran there are no counselor or any professionals out there to help me, so I decided to ask here. I started with Visual Basic and after 1 year I started to learn HTML , CSS , Javascript and JQuery. And for the past 6 months I've been learning PHP,and I have a basic understanding of OOP. I want to move to America to continue my studies and I was wondering which programming language helps me the most to get there? Should I learn C++ or JAVA or should I study Computer Science and Math? also since We are not in a good place financially, I want a programming language that helps me in college and lets me make some money? Thanks in advance and sorry for my poor English skills.

    Read the article

  • Simple vs Complex (but performance efficient) solution - which one to choose and when?

    - by ManojGumber
    I have been programming for a couple of years and have often found myself at a dilemma. There are two solutions - one is simple one i.e. simple approach, easier to understand and maintain. It involves some redundancy, some extra work (extra IO, extra processing) and therefore is not the most optimal solution. but other uses a complex approach,difficult to implement, often involving interaction between lot of modules and is a performance efficient solution. Which solution should I strive for when I do not have hard performance SLA to meet and even the simple solution can meet the performance SLA? I have felt disdain among my fellow developers for simple solution. Is it good practice to come up with most optimal complex solution if your performance SLA can be met by a simple solution?

    Read the article

  • Do the best developers look for a better job, or a better job finds them?

    - by Vasil Remeniuk
    As an example, one of the JavaPosse (popular Java podcast) hosts, Tor Norbey, has recently moved from Oracle to Google, and I'm more that sure that he has been lured (he definitely has not been sending his CV to Google). The rumor has it that 'high-level' developers are never hired through the job-sites. So, (given that you're a good developer) when you what to hold an appealing position in the company that interests you, and invest a lot of time into increasing your online-presence and self-branding blogging, twitting, contributing to opensource, actively participating in community sites (e.g., Stackoverflow), should you send your CVs here and there or just wait for proposals?

    Read the article

  • Should my colleagues review each others code from source control system?

    - by Daniel Excinsky
    Hi everybody. So that's my story: one of my colleagues uses to review all the code, hosted to revision system. I'm not speaking about adequate review of changes in parts that he belongs to. He watches the code file to file, line to line. Every new file and every modified. I feel just like being spied on! My guess is that if code was already hosted to control system, you should trust it as workable at least. My question is, maybe I'm just too paranoiac and practice of reviewing each others code is good? P.S: We're team of only three developers, and I fear that if there will be more of us, colleague just won't have time to review all the the code we'll write.

    Read the article

  • Is extensive documentation a code smell?

    - by Griffin
    Every library, open-source project, and SDK/API I've ever come across has come packaged with a (usually large) documentation file, and this seems contradictory to the wide-spread belief that good code needs little to no comments. What separates documentation from this programming methodology? a one to two page overview of a package seems reasonable, but elegant code combined with standard intelisense should have theoretically deprecated the practice of documentation by now IMO. I feel like companies only create detailed documentation and tutorials because its what they've always done. Why should developers have to constantly be searching through online documentation in order to learn how to do things when such information should be intrinsic to the classes, methods and namespaces?

    Read the article

  • How to start competitive programming?

    - by Vaibhav Agarwal
    I am practicing coding for a while but the problem is that it takes me a lot of time to write a solution for the problems. I want to ask if competitive programming can help me in improving this? If yes, then how should I start and from what site like TopCoder? I would obviously won't be able to solve very hard problems for now. What should I do? If no, what else should I do? I also have another problem that I want to learn coding but the thing is that I feel that I am not very good at it. What should I do? It's like bugging me from inside. I know some people may not find this question informative but please at least allow me to get an answer.

    Read the article

  • Making dummy applications while not involved in LIVE work [closed]

    - by Ratan Sharma
    I know this is subjective but I am looking for some real time helpful points/advice here, which will be helpful for some to get motivated. In our company so many people are on bench(not assigned with real time work) and they do not want to experiment things by their own. What would be a good motivation for them to keep their learning spirit? I personally feel that one can learn and give more effort in live client work than regular practicing things and making dummies. Am I right here or it is just my thinking only?

    Read the article

  • What are QUICK interview questions for the Microsoft stack development jobs?

    - by Dubmun
    I'm looking for your best "quick answer" technical interview questions. We are a 100% Microsoft shop and do the majority of our development on the ASP.NET web stack in C# and have a custom SOA framework also written in C#. We use a combination of Web Forms, MVC, Web Services, WCF, Entity Framework, SQL Server, TSQL, jQuery, LINQ, and TFS in a SCRUM environment. We are currently on .NET 3.5 with a very near transition to .NET 4.0. Our interviewing process includes a 55 minute interview with two technical people (usually an architect and a senior developer). The two interviewers have to share the time for questions. That isn't enough time for very many true programming problems so I'm looking for more good questions that have quick, yet meaningful, answers. We are mainly interviewing for Senior Dev positions right now but may interview for some Juniors in the future. Please help?

    Read the article

  • Choosing a subject to create a site for

    - by Daniel
    For 6 years I'm working as web developer and I would like to finally create my own site. I thought I have everything needed: programming and administration skills, found a good designer, own servers and understanding how to operate site. But I've missed very important (or the most important) point: how do I find a subject for my site? My hobby and my work are the same: IT, but I don't want to create just another tech blog or news aggregator, I want something different. First I thought things like Google Trends or Google top 1000 could help, but I've got lost in thousands of options I can't see them all (I actually can, but it'll take at least a couple of month). So my question is: how did you start? Where did you get the idea?

    Read the article

  • Writing Large Portions Of Code Then Debugging?

    - by The Floating Brain
    Lately I have been writing a game engine, and I have been writing a lot of "foundation stuff" (standard interfaces, modules, a message system ect.), but I have noticed a pattern, a lot of the stuff is interdependent and I can not debug until everything is done, hence I do not debug for about 3 to 5 hours at a time. I am wondering if this is an acceptable practice for this part of the project, and if not, if anyone can give me some advice? -----Update-----: I downloaded some code metrics tools, and my programs cyclomatic complexity is 1.52 which as I understand it is good, and should correlate to high cohesion, if I am wrong please correct me/

    Read the article

  • How to handle compensation issue

    - by Ali
    I consider myself an expert Software Developer. Recently, I noticed my current company posted a new job through a recruting firm requiring half experience than I have and even lesser set of skills. However, they are offering the same salary as my current salary. When I joined my current company a year ago, they declined to pay my asking salary. My evaluations are good and there are critical projects in the pipeline where my involvement is crucial for their success. I'm little confused on how to handle this situation. I don't want to come across threatning or any thing like that.

    Read the article

  • My Last "Catch-Up" Post for 2010 Content

    - by KKline
    I did a lot of writing in 2010. Unfortunately, I didn't do a good job of keeping all of that writing equally distributed throughout all of the channels where I'm active. So here are a few more posts from my blog, put on-line during the months of November and December 2010, that I didn't get posted here on SQLBlog.com: 1. It's Time to Upgrade! So many of my customers and many of you, dear readers, are still on SQL Server 2005. Join Kevin Kline , SQL Server MVP and SQL Server Technology Strategist...(read more)

    Read the article

  • Programming Interview Question [duplicate]

    - by user136494
    This question already has an answer here: How to prepare yourself for programming interview questions? [duplicate] 6 answers I have an upcoming interview in a couple of days and had a question for you guys. I've heard that programming interviews have whiteboard problems where you solve a simple problem on a whiteboard. My question to you is? How many whiteboard problems do you have to solve? Is there more than 1? What are examples of whiteboard problems? Is FizzBuzz one of them? Where can I find practice problems for them? Anyone know of any good web sites?

    Read the article

  • What use is a Business Logic Layer (BLL)?

    - by Andrew S. Arnold
    In reading up on good practice for database applications I've frequently come across advocates of so-called "business logic layers" and I'm trying to decide if it's best for my project to use one (it's a small personal project). My issue lies in the fact that I can't think of anything for the BLL to do that the DAL can't already handle (executing queries and mapping results to objects), so my BLL just calls the DAL without doing anything itself. Maybe I'm wrong about exactly what the DAL should be doing too. But regardless, what sorts of functionality should be expected of a BLL in a database management application?

    Read the article

  • Absolute Top Programming Tips [closed]

    - by Eric
    I'm very intersted in the stuff that REALLY makes a critical difference to career in programming, other than intrinsic stuff like how smart your are, where you were born, etc... Some ideas: 1) Best approach to managing small, medium, and large teams. 2) Most important books to read. 3) Most important skills to know. 4) Correct balance of learning theory vs. just writing code. 5) A good approach to estimating time and cost of a project. 6) Etc... Please limit your answers. If you see somebody has already written your idea, please just vote for their response. I'd like to see what the community thinks are the true indicators of a successful career in our field.

    Read the article

  • How to choose a new technology for mastering and not lose sense of reality and practicality?

    - by Eyewan
    How to choose the right next step in learning programming and mastering new technologies? I have experience with WinForms applications in C# .NET. Next what I see as a good area of expanding the knowledge is ASP.NET. Language I already know, C #, so I think there is now more a matter of mastering new technologies. Also I have interest in WPF. Perhaps the best is to work on ASP.NET and WPF at the same time. Sometimes the problem is when we do not have motivation, but also known to become a problem when we want to much :) How to choose a new technology for mastering and not lose sense of reality and practicality?

    Read the article

  • Good application for taking notes on 12.04?

    - by Ankit
    Is there a good note taking application in ubuntu like Evernote exists for windows and Mac users. Requirements for good applications:- A thumbnail/list preview for all the created notes. An integration with the email address so that we can view the notes anywhere anytime. Any easy way to input text, video, pdf, images etc. I have tried tomboy, basket notes. They aren't that good. Edit: Trying to install nevernote from an external source. But it has not satisfiable Further trying to install libssl gives the following error The following information may help to resolve the situation: The following packages have unmet dependencies: libssreflect-coq : Depends: coq-8.3pl3+3.12.1 but it is not installable libssreflect-ocaml : Depends: libcoq-ocaml-4zyg6 but it is not installable libssreflect-ocaml-dev : Depends: libcoq-ocaml-dev-4zyg6 but it is not installable E: Unable to correct problems, you have held broken packages. Anything that I might be doing wrong?

    Read the article

  • Is it better to build HTML Code string on the server or on the client side?

    - by Ionut
    The result of the following process should be a html form. This form's structure varies from one to user. For example there might be a different number of rows or there may be the need for rowspan and colspan. When the user chooses to see this table an ajax call is made to the server where the structure of the table is decided from the database. Then I have to create the html code for the table structure which will be inserted in the DOM via JavaScript. The following problem comes to my mind: Where should I build the HTML code which will be inserted in the DOM? On the server side or should I send some parameters in the ajax call method and process the structure there? Therefore the main question involves good practice when it comes to decide between Server side processing or client side processing. Thank you!

    Read the article

  • Am I bored with programming? [closed]

    - by user1167074
    I have started programming 2 years back and I have learnt web programming while working for big corporate companies. I was very passionate and I even did couple of side projects which were well appreciated by my friends and colleagues. But for the past 2 months I am not doing anything really interesting with programming, even if I get good ideas I am not feeling like coding, sub consciously I am feeling like "So What?" if I do this project. I would like to know from the more experienced programmers if this is just a phase or am I really missing something? Thanks

    Read the article

< Previous Page | 23 24 25 26 27 28 29 30 31 32 33 34  | Next Page >