How to implement poor-man's version control with TSQL queries

I have a table called Project. Each row completely describes a project and has a username, project name, project description and other numeric parameters that contain all the data about the project.
When multiple rows have the same username, this means a user owns multiple projects.
Now I want to implement a poor-man's version control for my users by adding a new integer column called version. When a user wants to save a new version of his project, the version is incremented and a new row is inserted into the table.
Some projects will have 1 version, others will have a dozen or more.
By default, the user should see a data grid of projects where only the latest version of the project is displayed (including the version count) and all the older versions of each project are ignored.
How do I write a TSQL query to populate this data grid (and ignore every version except the latest versions of each project)?
Thanks
Siegfried
siegfried heintze

Should this work? It prints all the rows.
DECLARE @Projects TABLE
([id] int IDENTITY(1,1), [Project] varchar(1), [Version] int)
INSERT INTO @Projects
([Project], [Version])
VALUES
('A', 1),
('A', 2),
('A', 3),
('A', 4),
('B', 1),
('B', 2),
('B', 3),
('C', 1),
('C', 2),
('D', 1)
-- DECLARE @User varchar(100)
SELECT *
FROM @Projects p
WHERE
-- UserName = @User AND
NOT EXISTS (SELECT 1
FROM @Projects q
WHERE q.id = p.id
AND q.Version < p.Version)
siegfried heintze
Nope you have condition wrong
In my suggestion i've used > and you replaced it with <
it should be this
SELECT *
FROM @Projects p
WHERE
NOT EXISTS (SELECT 1
FROM @Projects q
WHERE q.project= p.projects
AND q.Version > p.Version)
Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://visakhm.blogspot.com/ https://www.facebook.com/VmBlogs

Similar Messages

  • Version Control with Clearcase

    Will anybody tell me how to use clearcase for version control with Jdeveloper? I use clearcase for version control and Jdeveloper as IDE. What are the configuration changes to be made to link jdeloper IDE to clearcase repository so that I can checkout files from clear case directly to Jdev IDE and check them in directly to clear case version control repository.

    Hi Srinivas,
    Integrated support for Clearcase is coming in a future version of JDeveloper.
    In the meantime, you can use the checkin/checkout custom addin to drive clearcase.
    Download the custom addins package from:
    http://otn.oracle.com/products/jdev/info/CustomAddins.31/CustomAddinsJD31.zip
    Then have a look at
    http://otn.oracle.com/products/jdev/info/CustomAddins.31/CustomAddins.html#CheckOutIn.Java
    for instructions. You will need to alter CheckIn.bat to change the following line:
    put -S+_V -U %1
    to
    cleartool ci -nc -identical %1
    And alter CheckOut.bat to change the following line:
    get -l -Q -S+_V %1
    to
    cleartool co -nc -reserved %1
    Brian

  • How to implement Tool TIP in Table Control

    Hello Everyone,
    Can you please tell me how to implement a tooltip messages in table control columns.
    The Tooltip contains a simple message like "Doublde click on column.
    Thanks in advance.
    Edited by: Suruchi Razdan on Jun 6, 2011 7:57 AM

    Hello,
    In table Control->first Header Row has chance to maintain the Tooltip option.
    In table control columns maintain Double click options in attributes .
    Regards,
    Praveen

  • How to add Stored Procedures to Version Control

    My system mainly relies on stored procedures and I recently noticed I don’t have the version control for my database.
    So, my question is: How can I add stored procedures to version control?

    Once you have a database in a SQL Server Database Project, integrating to Source control is the same as any Visual Studio project. First you configure Visual Studio to use TFS for Version Control:
    Then you can configure a workspace connected to a TFS server and add your projects to source control.
    See, eg
    Walkthrough: Exploring Team Foundation Version Control
    David
    David http://blogs.msdn.com/b/dbrowne/

  • How to upgrade RoboHelp HTML 9 version-controlled projects to RoboHelp HTML 10

    Existing Environment:
    PC 1: RoboSource Control Server
    Windows 7, 64-bit, SP1
    Adobe TCS 3.5
    RoboHelp HTML 9
    RoboSource Control 3.1 (Server install)
    Microsoft SQL Server 2005
    PC 2:  Client
    Windows 7 Enterprise, 64-bit, SP1
    Adobe TCS 3.5
    RoboHelp HTML 9
    RoboSource Control 3.1 (Client install)
    PC 3:  Client
    Windows 7 Enterprise, 64-bit, SP1
    Adobe TCS 3.5
    RoboHelp HTML 9
    RoboSource Control 3.1 (Client install)
    PC 4:  Client
    Windows 7 Enterprise, 64-bit, SP1
    Adobe TCS 3.5
    RoboHelp HTML 9
    RoboSource Control 3.1 (Client install)
    PC 5:  Client
    Windows 7 Enterprise, 64-bit, SP1
    Adobe TCS 3.5
    RoboHelp HTML 9
    RoboSource Control 3.1 (Client install)
    We are upgrading from TCS 3.5 to TCS 4. In our existing TCS 3.5 environment, we have approximately 20 RoboHelp HTML 9 projects that are under version control. Our version control system is provided through RoboSource Control 3.1/Microsoft SQL Server 2005.
    I have determined that RoboSource Control 3.1 is provided with TCS 4. Therefore, it doesn't appear that we need to worry about upgrading the version control databases or the RoboSource Control software (we had to upgrade both the version control software and the version control databases when we upgraded from RoboHelp x5 to TCS 3.5).
    So, my primary question is this: After we run the TCS 4 install, what is the recommended process for opening our existing RoboHelp HTML 9 projects from the new RoboHelp HMTL 10? As I see it, there are three potential answers:
    Delete all existing RoboHelp HTML 9 "working" folders for the projects, and use RoboHelp HTML 10 to recreate the "working" folders from the version control databases.
    Simply open the existing RoboHelp HTML 9 "working" folders for the projects using RoboHelp HTML 10.
    It doesn't matter; either of the two options above will work.

    Hi,
    I'm not really familiar with RCS, but for other source control systems I recommend the following:
    1. Make sure that all your changes are checked in and that at least on pc has the latest version of all the files before updating TCS.
    2. Run the update.
    3. Now open the project on the pc that has the latest version of all files.
    4. After update, check in the entire project.
    5. Get the latest version on all pc's using the server. (Don't open the project in the client.)
         - Mostly, I just remove the entire project from the pc's and use a GET to get updated project from the server.
    I hope the RCS supports a get all from the server, if not, please ignore the above list.
    Greet,
    Willam

  • Version Control with JDeveloper application using ClearCase

    My team is evaluating J Developer to see if
    it matchs our requirement. We want
    to know how we will be able to use Clearcase
    as version control tool with our Java or JSP application developed using JDeveloper.
    We understand that J Developer will help us
    to create a zip file for deployment. Do we need to check in/out that zip file, zip/unzip the zip file, look for the file
    that we want to change, and then make change to it?
    If so how Clear Case knows which files in that zip file has been changed and what changes have been made?
    Currently, we use Clearcase to check in/out
    every single file, one at a time. We don't know how it will work with a zip file.
    Sincerely,
    Khanh

    Alex,
    There are two parts to this answer.
    You can hook up any version control system
    to JDeveloper using various JDeveloper
    extension mechanisms including adding items
    to the tools menu or complete wizards.
    On OTN, you can find an CustomAddins which provides a way to integrate to any version control system by editing some batch files to point to their "put" and "get" type tools. This is meant as a simple starting point.
    Starting with JDeveloper 3.2, you will be able to take advantage of the intergrated source control feature that integrates Oracle Repository's source control features into JDeveloper.
    I hope this helps,
    -John

  • How Do You Populate A Spark List Control With An Array?

    Hello, all,
    Sorry to come accross so frustrated, but how in the name of God do you populate a Spark list control with the data in an array?  You used to be able to do this with the mx:List control, but the guys developing Flex just had to make things more difficult than they need to be!  I am more of a code purist and prefer doing things the way they have been done for decades, but apparently nothing can ever stay simple!
    I simply want to populate a list control with an array and this shouldn't be rocket science!  I found out that I must use a "collection" element, so I decided that an arrayCollection would be best.  However, after searching Adobe's documentation about arrayCollections, I am lost in a black hole of data binding, extra lines of code just to add a new element, the need to sort it, etc...!
    Here is my code:
    var pendingArray:ArrayCollection = new ArrayCollection();
    for ( var i:int = 0 ; i < queue.length ; i++ )
         var item:UserQueueItem = queue[i] as UserQueueItem ;
         if ( item.status == UserQueueItem.STATUS_PENDING )
         pendingArray.addItem({label:item.descriptor.displayName,descriptor:item.descriptor});
    Here is the relevant MXML:
    <s:VGroup>
         <s:List id="knockingList" width="110" height="100"/>              
    </s:VGroup>
    I'm not getting any errors, but the list is not populating.
    I have seen several examples where the arrayCollection is declared and populated in MXML:
            <mx:ArrayCollection id="myAC">
                <!-- Use an fx:Array tag to associate an id with the array. -->
                <fx:Array id="myArray">
                    <fx:Object label="MI" data="Lansing"/>
                    <fx:Object label="MO" data="Jefferson City"/>
                    <fx:Object label="MA" data="Boston"/>
                    etc...
               </fx:Array>
            </mx:ArrayCollection>
    That may be fine for an example, but I think this is a rare situation.  Most of the time I would image that the arrayCollection would be created and populated on the fly in ActionScript!  How can I do this?
    Thanks in advance for any help or advice anyone can give!
    Matt

    In your post it seemed like you were trying to take care of many considerations at once: optimization, design, architecture.  I would suggest you get something up and running and then worry about everything else.
    If I use data binding, then I will probably have to declare the  arrayCollection as a global variable and then I'll have to write 100 or  so extra lines of code to addItem(), removeItem(), sort(), etc...  It  just seems like too much overhead.
    I believe you may have some misconceptions about databinding in general.  You won't have to make it a global variable and you certainly won't need an extra 100 lines of code.  If you did this forum would be a very , very quiet place.
    I don't want to use data binding because the original array is refreshed  often and there is one function called by an event that re-declares the  arrayCollection each time, populates it with the array, and then sets  it as the list's dataprovider.
    That is the beauty of the ArrayCollection, it can handle the updates to its source Array. I don't know if you need to redeclare the ArrayCollection, resetting the source to the new Array allows everyone involved to keep their references so you don't have to worry about any "spooky" stuff going on.

  • How to set the size of a control with the mouse ?

    hi all,
    i am writing a sort of ide (editor which creates applets very easy....) - for this purpose i need some hints from you guys:
    of course i need to create some controls like buttons...
    no prob - i am able to create buttons and place them at any place.
    BUT WHAT ABOUT THE SIZE ?
    ok, i have some ideas to realize this but what i want is a thick border arround the control with spots at each corner - when i place the cursor at one of these spots, my mouse cursor should change and it must be able to change the size of the control (while pressing and moving the mouse - you all know that from any ide).
    so how to do that?
    go on brains!!!
    THANX,
    andi

    I thought about creating dynamically resizable components, but gave it up as the effort seems too much for the benefit. I did a search for info on it and found a lot of people who wanted to do it, but not any who had actually done it completely. Here's some of my thoughts on the subject. You are right on about creating 'sizing handles', it seems to me the way to do this is to create your own container for any component (extend JPanel?) which can switch between no border and your new sizing border at some event. You will need to respond to mouse clicks on this border and follow the 'drag' event to find out where it was dropped. The java drag/drop events probably won't be of any use to you because each component will need an event handler. You need to catch them all.
    Finally, you need to figure out how to interact with some LayoutManager or write your own. Most LayoutManagers want to do their own resizing and you will have to deal with this. For example, GridBagLayout will not only resize all of the other components on the affected row and column, but unless you resize the other components, you won't be able to drag the top higher or the left lefter?

  • How to implement the pessimistic locking using toplink with sybase

    we want to allocate the unique primary key to each row when many user try to insert the records concurrently..So what we are trying to do is we calculate the maximum of Primary Key and incremented it by 1. Now we want to Apply the locking concept on the so that unique key will be allocated to each newly inserted row
    Can you please tell me
    1. how we can genrate unique primary key in toplink using sybase?
    2.how to implement the pessimistic or optimistic locking ?which one will be preferable?

    Hi brother
    I think that this link can help you
    http://download-east.oracle.com/docs/cd/A97688_16/toplink.903/b10064/database.htm#1007986
    Good luck

  • Version Control with JDeveloper

    Does any one know what version control packages can be used with JDeveloper? If you do, would you please let me know where I can get info on them.
    Thank you

    Alex,
    There are two parts to this answer.
    You can hook up any version control system
    to JDeveloper using various JDeveloper
    extension mechanisms including adding items
    to the tools menu or complete wizards.
    On OTN, you can find an CustomAddins which provides a way to integrate to any version control system by editing some batch files to point to their "put" and "get" type tools. This is meant as a simple starting point.
    Starting with JDeveloper 3.2, you will be able to take advantage of the intergrated source control feature that integrates Oracle Repository's source control features into JDeveloper.
    I hope this helps,
    -John

  • Version Control with DB

    I wonder if some version control like SourceJammer, Prowler can be used along with some relational database in Java Application.
    I am looking a requirement where along some relational data, I need to store some xml data as well and plan to use LOB feature of Database as most of the database are XML enabled. But I also need to display version history of those and get appropriate version and diff between version i.e. standard version control features along with check-in, check out. Open source solution is required.
    At present, it is something like
    Java Application -> O-R Mapper -> DB
    Now needed some thing like:
    Java Application -> O-R Mapper (should be here or before DB?) -> Version Control -> DB
    Any thoughts, pointers/directions will be useful.
    Thanks in advance.

    Doyou want version control of the scripts that you use to create databases, or do you want version control of the objects in your database.
    The former was descibed by another poster (i.e., wincvs). Alternatively, your data modeling tool should provide that type of service. For example, if you are using Oracle Designer then your data models can be versioned.
    The latter type of versioning is supported by Oracle workspace manager and the new 10.2 releases of Oracle Content DB and Oracle Records DB. There's also versioned tablespaces in 10g.
    -Mark
    http://www.remidata.com/book_nuts2soup.htm

  • How to delete the row in table control with respect to one field in module pool programming?

    Hi,
    Can I know the way to delete the row in table control with respect to one field in module pool programming
    Regards
    Darshan MS

    HI,
    I want to delete the row after the display of table control. I have created push button as delete row. If I click on this push button, the selected row should get deleted.
    I have written this code,
    module USER_COMMAND_9000 input.
    DATA OK_CODE TYPE SY-UCOMM.
    OK_CODE = SY-UCOMM.
    CASE OK_CODE.
         WHEN 'DELETE'.
            LOOP AT lt_source INTO ls_source WHERE mark = 'X'.
                APPEND LS_SOURCE TO LT_RESTORE.
                DELETE TABLE LT_SOURCE FROM LS_SOURCE.
                SOURCE-LINES = SOURCE-LINES - 1.
            ENDLOOP.
    But I'm unable to delete the selected rows, It is getting deleted the last rows eventhough I select the other row.
    So I thought of doing with respect to the field.

  • Poor Performance 7.0 Workbook with multiple queries

    Hi all,
    I've got the following issue. Our users have workbooks which contain serveral queries on different sheets. (One on each workbook sheet)
    When a workbook contains 5 or more queries, the overall workbook performance will decrease drastically. Workbook with 8 or more queries result in time-outs and messages like unsufficient shared memory.
    Does anyone have the same kind of problems with multiple queries in a Bex 7.0 workbook? Do any one have a solution?
    Any suggestions are welcome.
    Thanks!
    Cheers,
    Ron

    Bill,
    Tried to make a workbook according to your advise. It certainly makes a difference in workbook size. The new workbook is 50% smaller than the older version based on the standard SAP template.
    However, my workbook contains 17 queries, and after 5 minutes it breaks the BW connection. So basic conclusion is that BW 7.0 workbook can't work with a large number of dataproviders/ queries.  This did work in BEx BW 3.x.
    If any one has any other suggestion, more than welcome.
    Cheers,
    Ron

  • How to implement F4 help in table control

    Hi all,
    I am working on a table control in a module pool program. I have three fields in table control , material no. , material description and quantity. my requirement is , in table control , i need to provide the F4 help for material no. and material description, in a way, if i select material no. using F4, the corresponding material description field would be entered automatically in the table control field.
    Pls suggest me on this , if possible pls give me code or logic to do this.
    Thanks
    Saravan
    Moderator message: please don't post the identical question again after the first attempt was locked for good reasons. Search for available information before asking.
    Edited by: Thomas Zloch on Mar 3, 2011 11:54 AM

    Hi Saravana,
    Please search in SCN before posting. You will find many threads related to this question. The basic logic is you have to get the selected row of table control  using DYNP_GET_STEPL function in your POV. Then using function DYNP_VALUES_READ read the material and create the description to be displayed. You have use function F4IF_INT_TABLE_VALUE_REQUEST to display search help.

  • How to Set default value for taxonomywebtagging control with terms and nested terms

    Hi,
    I have created taxonomy control in custom aspx page and I am able to select terms but I am trying to setup default value to that control.
    Can anybody let me know how to set the default value for TaxonomyWebTagging control in custom.aspx page with nested terms?
    Any help would be greatly apprecited.
    Control code in aspx page:
    <td>
    <asp:Label runat="server" ID="lblLanguages">Field A: </asp:Label><asp:Label runat="server" ID="rfvlblLanguages" CssClass="errorMsg" ForeColor="Red">*</asp:Label>
    </td>
    <td>
    <Taxonomy:TaxonomyWebTaggingControl ID="term" Width="385px" runat="server" /></td>Mapping metedata code:TaxonomySession session = new TaxonomySession(SPContext.Current.Site);
    //Set the Business Unit Field
    SPSite site = SPContext.Current.Web.Site;
    TermStore termStore = session.TermStores["Managed Metadata Service"];
    Group group = termStore.Groups["GROUPName"];
    TermSet termSet = group.TermSets["TERMSETNAME"];
    Term term = termSet.Terms["TermA"];
    Guid termGuid = term.Id;
    term.SspId.Add(termStore.Id);
    term.TermSetId.Add(termSet.Id);
    term.AllowFillIn = true;
    term.AnchorId = countryGuid;
    term.IsMulti = true;
    Thank you.
    AA.

    Hi,
    According to your description, you want to set default value for TaxonomyWebTaggingControl.
    I have a test in my environment. It could be achieved by setting the Text Property of TaxonomyWebTaggingControl.
    Here is the code snippet:
    TaxonomySession session = new TaxonomySession(SPContext.Current.Site);
    SPSite site = SPContext.Current.Web.Site;
    TermStore termStore = session.TermStores["Managed Metadata Service"];
    Group group = termStore.Groups["GroupA"];
    TermSet termSet = group.TermSets["A"];
    Term term = termSet.Terms["A1"];
    TaxonomyWebTaggingControl1.SspId.Add(termStore.Id);
    TaxonomyWebTaggingControl1.SSPList = termStore.Id.ToString();
    TaxonomyWebTaggingControl1.TermSetId.Add(termSet.Id);
    TaxonomyWebTaggingControl1.TermSetList = termSet.Id.ToString();
    TaxonomyWebTaggingControl1.AllowFillIn = true;
    TaxonomyWebTaggingControl1.IsAddTerms = true;
    TaxonomyWebTaggingControl1.IsMulti = false;
    TaxonomyWebTaggingControl1.Text = string.Format("{0}|{1}", term.Name, term.Id.ToString());
    Here is a detailed article for your reference:
    http://blog.bugrapostaci.com/2010/09/23/taxonomywebtaggingcontrol-sharepoint/
    Feel free to Reply the test result.
    Thanks
    Patrick Liang
    Forum Support
    Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Subscriber Support, contact
    [email protected]
    Patrick Liang
    TechNet Community Support

Maybe you are looking for

  • Acrobat Pro X "quits unexpectedly" after installing CS6

    Hello. I just installed CS6 and all applications are working except for Acrobat Pro X. I have already tried and retried the deactiviation/reactiviation fix that everyone is recommending, have rebooted, have reinstalled the entire Suite, and various o

  • Safari shutting down because of UltraMPto.so plugin. Help!

    Every 20 minutes or so safari is unexepectedly quitting because of a plugin called UltraMPto.so. I don't know where this plugin came from. PLEASE HELP. It is very frusterating:( Here is the message that I receive: rocess:         Safari [376] Path:  

  • Stop Looping SWF?

    I am using Flash video, in the form of SWF files, in an online game I am creating but I am having a problem where the video clips constantly loop instead of playing once and stopping. Is this looping caused by some type of setting I unknowingly made

  • Finance for Wire , Check request ,Fixed Assets for the Capital Expenditure

    Hi, We are trying integrate the Finance for Wire , Check request ,Fixed Assets for the Capital Expenditure with adobe forms. Where would i find more information regarding the same? what tables are used and what are related t-codes which can give more

  • Can´t find HP Printer Assistant

    HP Deskjet 1050A J410 with Win 8.1 Have tried numerous suggestions from various sources but I cannot get Printer Assistant to open. I cannot even find it on my computer eg .exe file. Have deleted HP software and re-installed with different combinatio