Search Results

Search found 7870 results on 315 pages for 'auto increment'.

Page 2/315 | < Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >

  • What is the corrrect way to increment a field making up part of a composit key

    - by Tr1stan
    I have a bunch of tables whose primary key is made up of the foreign keys of other tables (Composite key). Therefore for example the attributes (as a very cut down version) might look like this: A[aPK, SomeFields] 1:M B[bPK, aFK, SomeFields] 1:M C[cPK, bFK, aFK, SomeFields] as data this could look like: A[aPK, SomeFields]: 1, Foo 2, Bar B[bPK, aFK, SomeFields]: 1, 1, FooData1 2, 1, FooData2 1, 2, BarData1 2, 2, BarData2 C[cPK, bFK, aFK, SomeFields]: 1, 1, 1, FooData1More 2, 1, 1, FooData1More 1, 2, 1, FooData2More 2, 2, 1, FooData2More 1, 1, 2, BarData1More 2, 1, 2, BarData1More 1, 2, 2, BarData2More 2, 2, 2, BarData2More I've got this running in a MSSQL DBMS and I'm looking for the best way to increment the left most column, in each table when a new tuple is added to it. I can't use the Auto Increment Identity Specification option as that has no idea that it is part of a composite key. I also don't want to use any aggregate function such as: MAX(field)+1 as this will have adverse affects with multiple users inputting data, rolling back etc. There might however be a nice trigger based option here, but I'm not sure. This must be a common issue so I'm hoping that someone has a lovely solution. As a side which may or may not affect the answer, I'm using Entity Framework 1.0 as my ORM, within a c# MVC application.

    Read the article

  • can't increment Glib::ustring::iterator (getting "invalid lvalue in increment" compiler error)

    - by davka
    in the following code: int utf8len(char* s, int len) { Glib::ustring::iterator p( string::iterator(s) ); Glib::ustring::iterator e ( string::iterator(s+len) ); int i=0; for (; p != e; p++) // ERROR HERE! i++; return i; } I get the compiler error on the for line, which is sometimes "invalid lvalue in increment", and sometimes "ISO C++ forbids incrementing a pointer of type etc... ". Yet, the follwing code: int utf8len(char* s) { Glib::ustring us(s); int i=0; for (Glib::ustring::iterator p = us.begin(); p != us.end(); p++) i++; return i; } compiles and works fine. according the Glib::ustring documentation and the include file, ustring iterator can be constructed from std::string iterator, and has operator++() defined. Weird? BONUS QUESTION :) Is there a difference in C++ between the 2 ways of defining a variable: classname ob1( initval ); classname ob1 = initval; I believed that they are synonymous; yet, if I change Glib::ustring::iterator p( string::iterator(s) ); to Glib::ustring::iterator p = string::iterator(s); I get a compiler error (gcc 4.1.2) conversion from ‘__gnu_cxx::__normal_iterator, std::allocator ’ to non-scalar type ‘Glib::ustring_Iterator<__gnu_cxx::__normal_iterator, std::allocator ’ requesed thanks a lot!

    Read the article

  • Increment my id in my insert request

    - by Mercer
    hello, i have a table with some rows. idClient, name, adress,country,... i want to know how i can do an insert into this table with auto increment my idClient in my sql request..? Thx. edit: i want do a request like this insert into Client values((select max(idClient),...)

    Read the article

  • WPF Formatting Issues - Automatically stretching and resizing?

    - by Adam S
    I'm very new to WPF and XAML. I am trying to design a basic data entry form. I have used a stack panel holding four more stack panels to get the layout I want. Perhaps a grid would be better for this, I am not sure. Here is an image of my form in action: http://yfrog.com/7gscreenshot1impp And here is the XAML code that generates it: <Window x:Class="Test1.Window1" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="Window1" Height="224" Width="536.762"> <StackPanel Height="Auto" Name="stackPanel1" Width="Auto" Orientation="Horizontal"> <StackPanel Height="Auto" Name="stackPanel2" Width="Auto"> <Label Height="Auto" Name="label1" Width="Auto">Patient Name:</Label> <Label Height="Auto" Name="label2" Width="Auto">Physician:</Label> <Label Height="Auto" Name="label3" Width="Auto">Insurance:</Label> <Label Height="Auto" Name="label4" Width="Auto">Therapy Goals:</Label> </StackPanel> <StackPanel Height="Auto" Name="stackPanel3" Width="Auto"> <TextBox Height="Auto" Name="textBox1" Width="Auto" Padding="3" Margin="1" /> <TextBox Height="Auto" Name="textBox2" Width="Auto" Padding="3" Margin="1" /> <TextBox Height="Auto" Name="textBox3" Width="Auto" Padding="3" Margin="1" /> <TextBox Height="Auto" Name="textBox4" Width="Auto" Padding="3" Margin="1" /> </StackPanel> <StackPanel Height="Auto" Name="stackPanel4" Width="Auto"> <Label Height="Auto" Name="label5" Width="Auto">Date:</Label> <Label Height="Auto" Name="label6" Width="Auto">Patient Phone:</Label> <Label Height="Auto" Name="label7" Width="Auto">Facility:</Label> <Label Height="Auto" Name="label8" Width="Auto">Referring Physician:</Label> </StackPanel> <StackPanel Height="Auto" Name="stackPanel5" Width="Auto"> <TextBox Height="Auto" Name="textBox5" Width="Auto" Padding="3" Margin="1" /> <TextBox Height="Auto" Name="textBox6" Width="Auto" Padding="3" Margin="1" /> <TextBox Height="Auto" Name="textBox7" Width="Auto" Padding="3" Margin="1" /> <TextBox Height="Auto" Name="textBox8" Width="Auto" Padding="3" Margin="1" /> </StackPanel> </StackPanel> </Window> What I really want is for the text boxes to stretch equally to fill up the space horizontally. I would also like for the controls in each vertical stackpanel to 'spread out' evenly as the window is resized vertically. Can any of you experts out there help me out?

    Read the article

  • mySQL auto increment problem: Duplicate entry '4294967295' for key 1

    - by Josh
    I have a table of emails. The last record in there for an auto increment id is 3780, which is a legit record. Any new record I now insert is being inserted right there. However, in my logs I have the occasional: Query FAIL: INSERT INTO mail.messages (timestamp_queue) VALUES (:time); Array ( [0] => 23000 [1] => 1062 [2] => Duplicate entry '4294967295' for key 1 ) Somehow, the autoincrement jumped up to the INT max of 4294967295 Why on god's green earth would this get jumped up so high? I have no inserts with an id field. The show status for that table, Auto_increment table now reads: 4294967296 How could something like this occur? I realize the id field should perhaps be a big int, but the worry I have is that somehow this thing jumps back up. Josh

    Read the article

  • Sql Server CE - Temporary disable auto increment on a specific collum

    - by Fábio Antunes
    Hi guys. I have this little question, thats been on my head for while now. Here it goes: Is it possible to temporary disable the Auto_Increment on the collum ID. So that i can add a new row to the table and being able specify the ID value when inserting the row. And then in the end enable the Auto_Increment again, and let do its work as usual? And if its possible how can i do it. The Table structure is very simple Collum Name (atributes) ID (Primary Key, Auto Increment, int, not null) Name (nvarchar(100), not null) Notice: The table name is: People. Lets also consider that the table already has data and cannot be changed. The database server is SQL Server CE. The SQL commands will be executed in a C# program, if its of any help. I really hope its possible, it would come very handy. Thanks

    Read the article

  • MYSQL - How to increment fields in one row with values from another row

    - by Walker Boh
    I have a table that we'll call 'Sales' with 4 rows: uid, date, count and amount. I want to increment the count and amount values for one row with the count/amount values from a different row in that table. Example: UID | Date | Count | Amount| 1 | 2013-06-20 | 1 | 500 | 2 | 2013-06-24 | 2 | 1000 | Ideal results would be uid 2's count/amount values being incremented by uid 1's values: UID | Date | Count | Amount| 1 | 2013-06-20 | 1 | 500 | 2 | 2013-06-24 | 3 | 1500 | Please note that my company's database is an older version of MYSQL (3.something) so subqueries are not possible. I am curious to know if this is possible outside of doing an "update sales set count = count + 1" and likewise for the amount columns. I have a lot of rows to update and incrementing the values individually is quite time consuming if you can imagine. Thanks for any help or suggestions!

    Read the article

  • mysql add auto increment and a additional key

    - by Lee
    Hey all I am trying to alter a table with adding a new column setting it as auto increment and with a key. The table already has one key and this one will be an addition. The error I get is the following. error : Multiple primary key defined My code is: alter table user add column id int (11) NOT NULL AUTO_INCREMENT PRIMARY KEY FIRST; I have also tries wrapping the key name ie alter table user add column id int (11) NOT NULL AUTO_INCREMENT PRIMARY (id) KEY FIRST; But still no luck. How can it be done ?

    Read the article

  • MySQL, C++: Retrieving auto-increment ID

    - by Thomas Matthews
    I have a table with an auto-incrementing ID. After inserting a new row, I would like to retrieve the new ID. I found an article that used the MySQL function LAST_INSERT_ID(). The article says to create a new query and submit it. I'm using MySQL Connector C++, Windows XP and Vista, and Visual Studio 9. Here are my questions: Is there an API, for the connector, that will fetch the ID out of the record? Does the result set, after an insert/append, contain the new ID? The LAST_INSERT_ID is MySQL specific. Is there an SQL standard method for obtaining the new ID?

    Read the article

  • Increment a value from AAA to ZZZ with cyclic rotation

    - by www.openidfrance.frfxkim
    Hi all, I need to code a method that increment a string value from AAA to ZZZ with cyclic rotation (next value after ZZZ is AAA) Here is my code: public static string IncrementValue(string value) { if (string.IsNullOrEmpty(value) || value.Length != 3) { string msg = string.Format("Incorrect value ('{0}' is not between AAA and ZZZ)", value); throw new ApplicationException(msg); } if (value == "ZZZ") { return "AAA"; } char pos1 = value[0]; char pos2 = value[1]; char pos3 = value[2]; bool incrementPos2 = false; bool incrementPos1 = false; if (pos3 == 'Z') { pos3 = 'A'; incrementPos2 = true; } else { pos3++; } if (incrementPos2 && pos2 == 'Z') { pos2 = 'A'; incrementPos1 = true; } else { if (incrementPos2) { if (pos2 == 'Z') { pos2 = 'A'; incrementPos1 = true; } pos2++; } } if (incrementPos1) { pos1++; } return pos1.ToString() + pos2.ToString() + pos3.ToString(); } I know this piece of code is quite dirty and not very efficient but I dont know how to do it properly. How is secured this snippet? (this will only run on windows plaform) How can I optimize-it and make it more readable ? Thanks for your comments

    Read the article

  • Increment non unique field during SQL insert

    - by phill
    I'm not sure how to word this cause I am a little confused at the moment, so bare with me while I attempt to explain, I have a table with the following fields: OrderLineID, OrderID, OrderLine, and a few other unimportant ones. OrderLineID is the primary key and is always unique(which isn't a problem), OrderID is a foreign key that isn't unique(also not a problem), and OrderLine is a value that is not unique in the table, but should be unique for any OrderIDs that are the same...so if that didn't make sense, perhaps a picture OrderLineID, OrderID, OrderLine 1 1 1 2 1 2 3 1 3 4 2 1 5 2 2 For all OrderIDs there is a unique OrderLine. I am trying to create an insert statement that gets the max OrderLine value for a specific OrderId so I can increment it, but it's not working so well and I could use a little help. What I have right now is below, I build the sql statement in a program and replace OrderID # with an actual value. I am pretty sure the problem is with the nested select statement, and incrementing the result, but I can't find any examples that do this since my google skills are weak apparently.... INSERT INTO tblOrderLine (OrderID, OrderLine) VALUES (<OrderID #>, (SELECT MAX(OrderLine) FROM tblOrderLine WHERE orderID = <same OrderID #>)+1) any help would be nice.

    Read the article

  • Increment part of a string in Ruby

    - by Rik
    I have a method in a Ruby script that is attempting to rename files before they are saved. It looks like this: def increment (path) if path[-3,2] == "_#" print " Incremented file with that name already exists, renaming\n" count = path[-1].chr.to_i + 1 return path.chop! << count.to_s else print " A file with that name already exists, renaming\n" return path << "_#1" end end Say you have 3 files with the same name being saved to a directory, we'll say the file is called example.mp3. The idea is that the first will be saved as example.mp3 (since it won't be caught by if File.exists?("#{file_path}.mp3") elsewhere in the script), the second will be saved as example_#1.mp3 (since it is caught by the else part of the above method) and the third as example_#2.mp3 (since it is caught by the if part of the above method). The problem I have is twofold. 1) if path[-3,2] == "_#" won't work for files with an integer of more than one digit (example_#11.mp3 for example) since the character placement will be wrong (you'd need it to be path[-4,2] but then that doesn't cope with 3 digit numbers etc). 2) I'm never reaching problem 1) since the method doesn't reliably catch file names. At the moment it will rename the first to example_#1.mp3 but the second gets renamed to the same thing (causing it to overwrite the previously saved file). This is possibly too vague for Stack Overflow but I can't find anything that addresses the issue of incrementing a certain part of a string. Thanks in advance!

    Read the article

  • How does Exchange 2010 prevent auto-reply loop?

    - by Beaming Mel-Bin
    E.g., 2 users have auto-reply configured. User A sends a message to User B. User B's auto-reply gets sent to User A's mailbox. That, in turn, causes an auto-reply to be sent from User A and insanity ensues. How does Exchange 2010 prevent this scenario? Also, can Exchange 2010 prevent a user's mailbox sending more than one auto-reply to the same user in one day? Bonus: Assuming Exchange prevents this, how do I configure the settings?

    Read the article

  • Writing a simple incrementing counter in rails

    - by Trip
    For every Card, I would like to attach a special number to them that increments by one. I assume I can do this all in the controller. def create @card = Card.new(params[:card]) @card.SpecNum = @card.SpecNum ++ ... end Or. I can be blatantly retarded. And maybe the best bet is to add an auto-incremement table to mysql. The problem is the number has to start at a specific number, 1020. Any ideas?

    Read the article

  • Writing a simple incrementer counter in rails

    - by Trip
    For every Card, I would like to attach a special number to them that increments by one. I assume I can do this all in the controller. def create @card = Card.new(params[:card]) @card.SpecNum = @card.SpecNum ++ ... end Or. I can be blatantly retarded. And maybe the best bet is to add an auto-incremement table to mysql. The problem is the number has to start at a specific number, 1020. Any ideas?

    Read the article

  • Django BigInteger auto-increment field as primary key?

    - by Alex Letoosh
    Hi all, I'm currently building a project which involves a lot of collective intelligence. Every user visiting the web site gets created a unique profile and their data is later used to calculate best matches for themselves and other users. By default, Django creates an INT(11) id field to handle models primary keys. I'm concerned with this being overflown very quickly (i.e. ~2.4b devices visiting the page without prior cookie set up). How can I change it to be represented as BIGINT in MySQL and long() inside Django itself? I've found I could do the following (http://docs.djangoproject.com/en/dev/ref/models/fields/#bigintegerfield): class MyProfile(models.Model): id = BigIntegerField(primary_key=True) But is there a way to make it autoincrement, like usual id fields? Additionally, can I make it unsigned so that I get more space to fill in? Thanks!

    Read the article

  • Get Auto Increment value with MySQL query

    - by James Simpson
    I currently have a database with over 6 million rows and growing. I currently do SELECT COUNT(id) FROM table; in order to display the number to my users, but the database is getting large and I have no need to store all of those rows except to be able to show the number. Is there a way to select the auto_increment value to display so that I can clear out most of the rows in the database? Using LAST_INSERT_ID() doesn't seem to work.

    Read the article

  • Problem with auto increment primary key (MySQL).

    - by mathon12
    I have 2 tables each using other's primary key as a foreign key. The primary keys for both are set to auto_increment. The problem is, when I try to create and entry into one of the tables, I have no idea what the primary key of the entry is and can't figure out what to put in the other table as a foreign key. What should I do? Do I drop auto_increment altogether and cook up a unique identifier for each entry so I can use it to address the created entries? I'm using PHP, if that's relevant. Thanks.

    Read the article

  • The unary increment operator in pointer arithmetic

    - by RhymesWithDuck
    Hello, this is my first post. I have this function for reversing a string in C that I found. void reverse(char* c) { if (*c != 0) { reverse(c + 1); } printf("%c",*c); } It works fine but if I replace: reverse(c + 1); with: reverse(++c); the first character of the original string is truncated. My question is why would are the statements not equivalent in this instance? Thanks

    Read the article

  • Exchange 2007: Auto reply message to senders (server side)

    - by Mestika
    I’ve a need to create an auto-reply for some of the users in my organization where, when a person sends an E-mail to e.g. [email protected] is faced with an automatically auto-reply with some message “closed during the holidays. We are back at… etc. etc. etc.”. I’ve tried to create a Transport Rule on our Exchange server but the only option I can find in the actions-window is to reply with a “Bounce message to sender with enhanced status code” but I guess that is not the precise action I’m looking for. How can I set up a server-side auto-reply, apply it to only a fixed number of users in my organization and create a message to the senders (which is outside the organization)?

    Read the article

  • Exchange 2007: Auto reply message to senders (server side)

    - by Mestika
    Hi everyone and marry Christmas, I’ve to create an auto-reply for some of the users in my organization where, when a person sends an E-mail to e.g. [email protected] is faced with an automatically auto-reply with some message “closed during the holidays. We are back at… etc. etc. etc.”. I’ve tried to create a Transport Rule on our Exchange server but the only option I can find in the actions-window is to reply with a “Bounce message to sender with enhanced status code” but I guess that is not the precise action I’m looking for. How can I set up a server-side auto-reply, apply it to only a fixed number of users in my organization and create a message to the senders (which is outside the organization)? Sincerely Mestika

    Read the article

  • css absolute position won't work with margin-left:auto margin-right: auto

    - by user1118019
    Say you have the following css applied to a div tag .divtagABS { position: absolute; margin-left: auto; margin-right:auto; } the margin-left and margin-right does not take effect but if you have relative, it works fine i.e. ,divtagREL { position: relative; margin-left: auto; margin-right:auto; } why is that? i just want to center an element can someone explain why setting margins to auto in absolute position does not work?

    Read the article

  • Outlook meetings and auto accept/reply

    - by Morten
    First, I'm not sure if this question should be here or superuser, but here it comes. Im trying to set up a room to auto accept meetings and so far its good but i was wondering if it's possible to change it to "do not send respond" when it accepts and sends some reply when it's the same time as another existing meeting, so it declined. And a little extra question: is it possible to chance that auto reply it sends, since it's in English, and I would like to chance it to Danish and some text I choose myself?

    Read the article

< Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >