Search Results

Search found 1334 results on 54 pages for 'constraint satisfaction'.

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

  • Symfony FK Constraint Issue

    - by Daniel Hertz
    Hello! So I have a table schema that has users who can be friends. User: actAs: { Timestampable: ~ } columns: name: { type: string(255), notnull: true } email: { type: string(255), notnull: true, unique: true } nickname: { type: string(255), unique: true } password: { type: string(300), notnull: true } image: { type: string(255) } FriendsWith: actAs: { Timestampable: ~ } columns: friend1_id: { type: integer, primary: true } friend2_id: { type: integer, primary: true } relations: User: { onDelete: CASCADE, local: friend1_id, foreign: id } User: { onDelete: CASCADE, local: friend2_id, foreign: id } It builds the database correctly, but when I try to insert test data like: User: user1: name: Danny Gurt email: [email protected] nickname: danny password: test1 user2: name: Adrian Soian email: [email protected] nickname: adrian password: test1 FriendsWith: friendship1: friend1_id: user1 friend2_id: user2 I get this integrity constraint problem: SQLSTATE[23000]: Integrity constraint violation: 1452 Cannot add or update a child row: a foreign key constraint fails (`krowdd`.`friends_with`, CONSTRAINT `friends_with_ibfk_1` FOREIGN KEY (`friend1_id`) REFERENCES `user` (`id`) ON DELETE CASCADE) Any ideas? Thanks!

    Read the article

  • Altering constraint delete action

    - by Hobhouse
    I did this: ALTER TABLE `db`.`my_table` ADD CONSTRAINT FOREIGN KEY (`my_second_table_id`) REFERENCES `my_second_table` (`id`); I should have done this: ALTER TABLE `db`.`my_table` ADD CONSTRAINT FOREIGN KEY (`my_second_table_id`) REFERENCES `my_second_table` (`id`) ON DELETE SET NULL; Is it possible to ALTER this, or do I have to drop the constraint and add again?

    Read the article

  • Trying to modify a constraint in PostgresSQL

    - by MISMajorDeveloperAnyways
    Postgres is getting quite annoying lately. I have checked the documentation provided by Oracle and found a way to do this without dropping the table. Problem is, it errors out at modify as it does not recognize the keyword. Using EMS SQL Manager for PostgreSQL. Alter table public.public_insurer_credit MODIFY CONSTRAINT public_insurer_credit_fk1 deferrable, initially deferred; I was able to work around it by dropping the constraint using : ALTER TABLE "public"."public_insurer_credit" DROP CONSTRAINT "public_insurer_credit_fk1" RESTRICT; ALTER TABLE "public"."public_insurer_credit" ADD CONSTRAINT "public_insurer_credit_fk1" FOREIGN KEY ("branch_id", "order_id", "public_insurer_id") REFERENCES "public"."order_public_insurer"("branch_id", "order_id", "public_insurer_id") ON UPDATE CASCADE ON DELETE NO ACTION DEFERRABLE INITIALLY DEFERRED;

    Read the article

  • adding month to EndDate as constraint in Oracle SQL

    - by user2900611
    I've a question regarding Oracle database SQL. my employee each have a project, the end date of the project depends on the no of months that was given to them base on PTerm. Am i right to do it this way? CREATE TABLE PROJECT ( P_ID VARCHAR ( 20 ) NOT NULL, PNAME VARCHAR ( 100 ) NOT NULL, PTERM VARCHAR ( 20 ), PSTARTDATE DATE, PENDDATE DATE, CONSTRAINT PROJECT_PKEY PRIMARY KEY ( P_ID ), CONSTRAINT PROJECT_PTERM CHECK ( PTERM IN ('1 MONTH', '2 MONTH', '3 MONTH') ), CONSTRAINT PROJECT_ENDDATE CHECK ( PENDDATE = (PSTARTDATE + PTERM) ) );

    Read the article

  • Dropping duplicate|redundant Unique Constraint from FILESTREAM table

    - by electricsk8
    I have a table with a FILESTREAM column, and it has two unique constraints specified for the same FILESTREAM column, ie: ALTER TABLE [dbo].[TableName] ADD CONSTRAINT [UQ_TableName_33C4988760FC61CA] UNIQUE NONCLUSTERED ([GUID_Column]); GO ALTER TABLE [dbo].[TableName] ADD CONSTRAINT [UQ_TableName_33C49887145C0A3F] UNIQUE NONCLUSTERED ([GUID_Column]); GO I'd like to drop one of the unique constraints, as they are duplicates. However, when I try and drop one of the two duplicate constraints, I receive the following error. "A table with FILESTREAM column(s) must have a non-NULL unique ROWGUID column." Anyone know how to remove one of the two constraints?

    Read the article

  • What are the best ways to cope with «one of those days»? [closed]

    - by Júlio Santos
    I work in a fast-paced startup and am absolutely in love with what I do. Still, I wake up to a bad mood as often as the next guy. I find that forcing myself to play out my day as usual doesn't help — in fact, it only makes it worse, possibly ruining my productivity for the rest of the week. There are several ways I can cope with this, for instance: dropping the current task for the day and getting that awesome but low-priority feature in place; doing some pending research for future development (i.e. digging up ruby gems); spending the day reading and educating myself; just taking the day off. The first three items are productive in themselves, and taking the day off recharges my coding mana for the rest of the week. Being a young developer, I'm pretty sure there's a multitude of alternatives that I haven't come across yet. How can programmers cope with off days? Edit: I am looking for answers related specifically to this profession. I therefore believe that coping with off days in our field is fundamentally different that doing so in other areas. Programmers (especially in a start-up) are a unique breed in this context in the sense that they tend to have a multitude of tasks at hand on any given moment, so they can easily switch between these without wreaking too much havoc. Programmers also tend to work based on clear, concise objectives — provided they are well managed either by themselves or a third party — and hence have a great deal of flexibility when it comes to managing their time. Finally, our line of work creates the opportunity — necessity, if you will — to fit a plethora of tasks not directly related to the current one, such as research and staying on top of new releases and software updates.

    Read the article

  • Question to ask during interviews to get a sense of the development process

    - by davidk01
    I just watched a presentation about simplicity by Rich Hickey at InfoQ where he goes over the constructs programmers use to produce artifacts and how those constructs make various trade-offs when it comes to achieving simple artifacts. I think that most programmers would agree with a lot of what he says but at the end of the day I don't know how many development shops are actively practicing development processes and using tools that allow them to make simple artifacts. As an interview candidate I would like to work at a software development shop where producing simple artifacts is a top priority. What are some questions I can ask to figure out if the place that is interviewing me is actually such a place.

    Read the article

  • Outdoor Programming Jobs...

    - by Rodrick Chapman
    Are there any kinds of jobs that require programming (or at least competency) but take place outdoors for a significant portion of the time? As long as I'm fantasizing, an ideal job would involve programming in a high level language like Haskell, F#, or Scala* for, say, 50% of the time and doing something like digging an irrigation trench the rest of the time. My background: I triple majored in mathematics, philosophy, and history (BS/BA) and have been working as a web developer for the past six years. I love hacking but I'm feeling a bit burned out. *I only chose these languages as examples since, ideally, I'd want to work among high caliber people... but it really doesn't matter.

    Read the article

  • Manager keeps changing requirement specification after every demo.

    - by Jungle Hunter
    Background of my working environment My manager has no background or understanding of computers or software whatsoever. It is highly likely he hasn't seen code in any form (not even from a physical distance of 10 feet or less) in his life. There is no one who understands the complexity of what I am asked to implement. To the point that if I semi-hardcode no one would know. On Joel's test we score an unbelievable score 0. The problems The manager and at times other "senior" keep changing the requirement specification. Changes which, if good engineering be done and not patchy "fixes", require change in the underlying design. There is absolutely no one who looks at code (probably because no one knows how to, or even if it should be done) which means no one will ever be able to: Appreciate the complexity of the problem or the elegance of the solution. Suggest improvement to the approach. Appreciate the quality of the code. Point out where the code can be improved. A lot of jargon is used which makes sense grammatically but fails to make any sense any other way. Doesn't feel, behave or work like a software company. The question What should be done? Especially regarding there being no one who would point out improvements in my code. Update To answer HLGEM's (and possibly others) question about what I've done to try and fix it. I offered to set up Redmine and introduce source control to everyone. I said I would recommend distributed (git or mercurial) but will also talk about centralized ones and let the team decide. Response was that things are being done and will be done within weeks. Haven't seen that nor am I aware if other parts of the company use it.

    Read the article

  • Programmers and Database Professionals in Performance Based Companies

    - by swisscheese
    Anybody here work for a company (or know of someone that does) in the fields of programming or anything related to DBs and not have set work hours? Where you are paid for performance rather than how many hours you sit in a chair at the office? Any project / company I have been apart of always has pretty strict primary hours with the "great opportunity" / expectation to stay until the job is done. Is this type of flexibility really feasible in a group environment in these fields? Would pay for performance work within a company in these fields? With having strict primary hours I notice a lot of inefficiencies. Some weeks or days there is only so much that can be done (for whatever the reason may be) and if your work is done it doesn't help moral to force someone to stay for 8 hrs/day or 40hrs/week if the next week they may have to pull a 60+hr work week. I know that a lot of flexibility can come from working independently or as a consultant so this question really does not encompass those types of positions.

    Read the article

  • What to do if I am working on a language that I don't like

    - by Sayem Ahmed
    Hi there, I really don't know if this is the right place to ask this question, but if it isn't, then I guess someone will notify. Anyway, I am working in a software development farm which is currently using PowerBuilder to develop a mid-size ERP solution. The work environment and company management are so great that it may be the best in the whole Bangladesh. Only problem is the technology that are currently being used, which is this PowerBuilder. Now I am a guy who tends to prefer modern development technologies, like DI containers, ORM, TDD, JQuery etc. PowerBuilder is a great tool too, but I couldn' like the application techniques used to build PB applications. These techniques are so inheritance-dependent that many a times these create a great deal of sufferings. I remember two days ago I had to change some processing logic in a core user object and as a result I had to test and re-test all the forms that the application have(apparently, there are almost 20 forms there, each of them with 3-4 kinds of functionalities). Also, learning PB is tough, because online material on this thing is very, very low. I can't afford to read all the documentation that PB provide because I have hard deadlines on the work that I have to do. Another thing with PB is that applications tend to rely on business logic that are implemented on databases which causes debugging to be a nightmare. As a result, I don't feel motivated enough to work in this IDE/System/Framework (or whatever) anymore. My productivity has greatly decreased, and I am not delivering quality code. I think I have the following options available to me - Remain in the current job, keep delivering worse code and let my productivity decrease day by day, taking salaries and bonuses but not delivering quality codes/doing my job the way I should, Search for a new job. At this point number 2 seems a good option, but there are also some issues. As I mentioned before, our management may be the best in the country. Our company owner is himself a software developer with 24 years of experience in software development. He is currently our Team Leader and System Analyst. He is by far the greatest manager and boss I have ever seen. He understands developer's mentality very well(as he IS himself a developer). He is also a great, kind and generous guy. Our company is only a start-up company with 10 developers. Among them, only 3-4 people knows about the business logic behind the ERP, and I am one of them. If I switch my current job, it may hamper the development of this product which I really don't want. I couldn't decide what to do in this situation, so I turned to the community for advice.

    Read the article

  • Bad style programming, am I pretending too much?

    - by Luca
    I realized to work in an office with a quite bad code base. The base library implemented in years and years is quite limited, and most of that code is, honestly, horrible. Projects developed in the office are very large. Fine. I could define me a "perfectionist" (but often I'm not), and I thought to refactor an application (really a portion), which need a new (complex) feature. But, today, I really realized that it's not possible to refactor that application modules with a reasonable time (say, 24/26 hours, respect the avaialable time for the task, which is 160 hours). I'm talking about (I am a bit ashamed to say) name collisions, large and frequent cut & paste code, horrible and misleading naming, makefiles without dependencies (!), application login is spread randomly across many different sources, dead code, variable aliasing, no assertion, no documentation, very long source files, bad/incomplete include file definition, (this is emblematic!) very frequent extern declaration of variables and functions, ... I'm sure to continue ... buffer overflows because sprintf, indentation (!), spacing, non existent const modifier usage. I would say that every source line was written quite randomly when needed, without keeping in mind some design (at least, the obvious one). (Am I in hell?) The problem arises when the application is developed by a colleague of mine. I felt very frustrated. So, I decided to expose the "situation" to my colleague; at the end, that was a bad idea. He is justified in saying that "the application was developed in haste, so it is natural that it is written vaguely; you are wasting time to think and implement an elegant implementation" .... I'm asking too much from my colleague to write readable code, which is managed and documented? I expect too much in not having to read thousands of lines of code to understand how a particular logic?

    Read the article

  • Career Advice: finding challenging work in software and web development

    - by dianovich
    Having left my physics degree early, I started out in the realm of web design / front end web development and was able to get work quite quickly. I moved on to spend a chunk of my time on servers and gained experience with frameworks like Wordpress and Drupal, then the likes of Codeigniter and CakePHP and became comfortable in Debian-based and RHEL/CentOS environments. I ventured in to iOS development and published a couple of native apps to the app store too! I have started to spend a good deal of my time writing Python and have invested a little time in Django. The problem is, I still spend a fair chunk of my time doing more front end web development (writing markup and CSS for site themes, design-lead JavaScript, small applications for which application architecture and software engineering are relatively unimportant or too time consuming to invest in) in my job. What I want to do is really exercise the systematic/logical portion of my brain and tackle challenging problems on a daily basis. I want to have to care about big-oh running times, modularity in software, DRY, performance tuning and development methodologies. I want to work for a firm whose clients say: "Yes, these things are important to us and we'll pay you to get them right." But it is difficult: I have no formal training and am potentially becoming a jack of all trades. Not that being a jack of many trades is necessarily a bad thing, but the scope of work I find myself involved in is far too broad. And, there are only so many hours in a day outside of work! My question is: where do I go from here? I am starting to work on a few open source projects and have started to publish content to my blog. But this isn't likely to make it past the recruitment consultants and HR departments of many-a-firm. And I do not, for example, work in a team that practices agile methodologies, so how do I get work in such a team to gain experience? While I have been responsible for implementing version control and some solid working practices into our current environment, there is only so far I can go in this context. What would convince you that i'm worth taking a risk? What would convince you that i'll have caught up the other guys in your employ in next to no time?

    Read the article

  • Challenging Job after Graduate Studies

    - by sriram
    I worked with an M.N.C developing web applications in Java/J2EE related technologies(includes JSF,struts,hibernate etc.) now I quit my job to pursue Graduate Studies in the U.S.A. So I am a student in the middle of my Graduate studies. I had enough of developing mere CRUD applications in J2EE now I want to work in something exciting. The problem is I can't say what exactly but I can give you an examples. Say developing new JDK libraries or writing a kernel for some O.S. or something like that. So I have five questions here. Is it true that people in R & D often use C++ because of higher performance in that case should I consider switching my platform to C/C++? How should I use my time I have one year to graduate to prepare myself for Jobs Interviews for such positions? (e.g. Reading books on Algorithms etc.) How do I know about these jobs and how do I apply to those Jobs? Is it the right time for me to think about Jobs? Am I over ambitious because I am not in a Ivy League, just a normal school? (My GPA is not so high unfortunately).

    Read the article

  • Pros and Cons of various career paths [closed]

    - by Snitse
    What are the advantages and disadvantages of various career paths within CS? By a path I mean something like: Web Development GUI Development Sys admin/DB admin/network admin Security (maybe should be grouped with sys admin) Programming back end (like a C programmer) Algorithm Development heavy programming And any other you think should be in this list. What are the various areas in which each of these professions excels, or lags?

    Read the article

  • Forced to be trained [closed]

    - by steeb
    is it OK to force employees to take a training in order to make them sign a contract to stay in the job for X years? Here I'm the only developer in the company and before this job I've developed in VB6, VB.Net and others. There are others technicians here but they query the database server to make reports and make little programs but do not spend all day in programming. I was hired here to manage some legacy data to be migrated to a new system and I used my experience to accomplish the task. I also have made some utilities and other developments. Since we went live with the new system I've been developing a lot of side programs, add-ons and changed the source code of it and basically I've been learning from it since then and became some sort of jack of all trades when some feature needs to be changed or corrected. I have one and a half year in this company but during the last 8 months I've been entirely programming in the system. There have been times when even the implementers ask me how I accomplish certain things. The issue here is that the company has come and told me and other co-workers (which do not program in the system but know basic programming and databases) to have a basic training to program for the new system's platform and when we finish it we will sign a contract to stay in the company for an unspecified time. They have offered also an unspecified better salary. I'm feeling very suspicious cause I know the basics of system and I don't understand why I have to take it, being known by everybody all developments I've made. I gathered with my boss and told him that I should not take that course because I feel that I can learn more with all the daily requirements I've been asked and they should save that money. But he responded me that I have to take it and sign after that. I think they want me to be with them for a long time, and I'd like to, but my opinion is that I would like to stay in the company because I feel comfortable in all laboral aspects (including salary) but not because I signed a contract forced to do more tasks and forced to say no if I have others and better job offers. What advice can you give me in this kind of situation?

    Read the article

  • How quickly to leave contract-to-hire gig where you don't want to be hired? [closed]

    - by nono
    So you move to a big new city with tons of software development opportunity, having taken a six month contract-to-hire job. The company treats you really well and has a good team and work environment. However, the recruiter assured you when offering the gig that it would be a good position in which you can advance your learning from more senior developers (a primary concern of yours) but you're starting to realize that a job recruiter isn't going to understand that the team in question isn't very up on modern software practices (you start to sympathize with this guy and read his post over and over again: http://stackoverflow.com/questions/1586166/career-killer-nhibernate-oop-design-patterns-domain-driven-design-test-driv) and that much of the company's software is very old and very very poorly architected, and the company (like so many others) seems to be only concerned with continually extending the software without investing in any structural improvements. You're absolutely dismayed at how long it takes your team (including) to fulfill simple feature requests (maybe 500-1000% longer than with better designed software that you've worked on in the past), but no one else there seems to think anything of it. You find that the work and the company's business are intensely uninteresting to you, but due to the convoluted design of their various software systems, fulfilling the work will require as much mental engagement as any other development position. You feel a bit naive about not having asked the right questions during your interview process, and for not having anticipated that your team at your former podunk company might possibly be light-years ahead of any team in Big Shiny City, but you know you don't want to stay at this place, and (were it not for your personal, after-hours studying and personal programming efforts) fear that you might actually give a worse interview after completing your 6 months than you did when you started at the place. You read about how hard of a time local companies are having filling their positions with qualified software development candidates. You read all sorts of fabulous sounding job postings online and feel like you're really missing out. In spite of the comfortable environment you feel like you would willingly accept a somewhat more demanding or aggressive lifestyle to feel like you are learning and progressing and producing something meaningful. My questions are: how quickly do you leave and how do you go about giving a polite reason for departing? The contract is written to allow them to "can" you and to allow you to leave with 2 weeks notice. Do you ethically owe the 6 months? Upon taking the position, the company told you they were not interested in candidates who were intending to only stay for 6 months and then leave (you were not intending to bail after 6 months, at that time), so perhaps they might be fine if you split now, knowing that you don't want to stick around for the full time hire?

    Read the article

  • How strict are standard employer IP agreements about coding outside of work?

    - by JosephRT
    I'm in negotiations for a position with a large corporation and I'm reading their employment terms. In their IP/copyright section they state that anything that I do outside of work that is "similar" to what I perform on the job is also theirs. I understand that it's intentionally very vague to protect them, but I'm also a little nervous that it could be abused. The way I read it, anything I produce outside of work could be claimed as well, because it would fall under "programming". Is this relatively standard? Could I negotiate more specific terms (I have asked if I could get clarification)? Should I be worried that they could abuse this? I just don't want to be caught in a situation where come up with a (potentially) great idea outside of work and they swoop down and lay claim to it.

    Read the article

  • Are you satisfied with your programming? [closed]

    - by Richart Bremer
    If you are a programmer, are you satisfied with it? I really love to code. I code all kinds of things. I used to play computer games but they are not that interesting compared to developing a new search algorithm or similar. But sometimes I look into the future and see myself being 80 years old, sitting in front of a computer and everything I will have written will be rewritten because the programming languages do not exist anymore. I look back on my life and think "that's it?". Everything I wrote in the past is virtual and ultimately gone. I tried other things but coding is the only thing that does it for me. And at the same time I think I am wasting my life. What about you? Disclaimer: I presume this is the best forum for this question. If you don't agree suggest better place to migrate the question. If you can't, don't close it. Thank you.

    Read the article

  • Constraint Satisfaction Problem

    - by Carl Smotricz
    I'm struggling my way through Artificial Intelligence: A Modern Approach in order to alleviate my natural stupidity. In trying to solve some of the exercises, I've come up against the "Who Owns the Zebra" problem, Exercise 5.13 in Chapter 5. This has been a topic here on SO but the responses mostly addressed the question "how would you solve this if you had a free choice of problem solving software available?" I accept that Prolog is a very appropriate programming language for this kind of problem, and there are some fine packages available, e.g. in Python as shown by the top-ranked answer and also standalone. Alas, none of this is helping me "tough it out" in a way as outlined by the book. The book appears to suggest building a set of dual or perhaps global constraints, and then implementing some of the algorithms mentioned to find a solution. I'm having a lot of trouble coming up with a set of constraints suitable for modelling the problem. I'm studying this on my own so I don't have access to a professor or TA to get me over the hump - this is where I'm asking for your help. I see little similarity to the examples in the chapter. I was eager to build dual constraints and started out by creating (the logical equivalent of) 25 variables: nationality1, nationality2, nationality3, ... nationality5, pet1, pet2, pet3, ... pet5, drink1 ... drink5 and so on, where the number was indicative of the house's position. This is fine for building the unary constraints, e.g. The Norwegian lives in the first house: nationality1 = { :norway }. But most of the constraints are a combination of two such variables through a common house number, e.g. The Swede has a dog: nationality[n] = { :sweden } AND pet[n] = { :dog } where n can range from 1 to 5, obviously. Or stated another way: nationality1 = { :sweden } AND pet1 = { :dog } XOR nationality2 = { :sweden } AND pet2 = { :dog } XOR nationality3 = { :sweden } AND pet3 = { :dog } XOR nationality4 = { :sweden } AND pet4 = { :dog } XOR nationality5 = { :sweden } AND pet5 = { :dog } ...which has a decidedly different feel to it than the "list of tuples" advocated by the book: ( X1, X2, X3 = { val1, val2, val3 }, { val4, val5, val6 }, ... ) I'm not looking for a solution per se; I'm looking for a start on how to model this problem in a way that's compatible with the book's approach. Any help appreciated.

    Read the article

  • Divide people into teams for most satisfaction

    - by Jweede
    Just a curiosity question. Remember when in class groupwork the professor would divide people up into groups of a certain number (n)? Some of my professors would take a list of n people one wants to work with and n people one doesn't want to work with from each student, and then magically turn out groups of n where students would be matched up with people they prefer and avoid working with people they don't prefer. To me this algorithm sounds a lot like a Knapsack problem, but I thought I would ask around about what your approach to this sort of problem would be.

    Read the article

  • trigger execution against condition satisfaction

    - by maheshasoni
    I have created this trigger which should give a error, whenever the value of new rctmemenrolno of table-receipts1 is matched with the memenrolno of table- memmast, but it is giving error in both condition(it is matched or not matched). kindly help me. CREATE OR REPLACE TRIGGER HDD_CABLE.trg_rctenrolno before insert ON HDD_CABLE.RECEIPTS1 for each row declare v_enrolno varchar2(9); cursor c1 is select memenrolno from memmast; begin open c1; fetch c1 into v_enrolno; LOOP If :new.rctmemenrolno<>v_enrolno then raise_application_error(-20186,'PLEASE ENTER CORRECT ENROLLMENT NO'); close c1; end if; END LOOP; end;

    Read the article

  • trigger execution against condition satisfaction

    - by maheshasoni
    I have created this trigger which should give a error, whenever the value of new rctmemenrolno of table-receipts1 is matched with the memenrolno of table- memmast, but it is giving error in both condition(it is matched or not matched). kindly help me. CREATE OR REPLACE TRIGGER HDD_CABLE.trg_rctenrolno before insert ON HDD_CABLE.RECEIPTS1 for each row declare v_enrolno varchar2(9); cursor c1 is select memenrolno from memmast; begin open c1; fetch c1 into v_enrolno; LOOP If :new.rctmemenrolno<>v_enrolno then raise_application_error(-20186,'PLEASE ENTER CORRECT ENROLLMENT NO'); close c1; end if; END LOOP; end;

    Read the article

  • SQL SERVER – Disable Clustered Index and Data Insert

    - by pinaldave
    Earlier today I received following email. “Dear Pinal, [Removed unrelated content] We looked at your script and found out that in your script of disabling indexes, you have only included non-clustered index during the bulk insert and missed to disabled all the clustered index. Our DBA[name removed] has changed your script a bit and included all the clustered indexes. Since our application is not working. When DBA [name removed] tried to enable clustered indexes again he is facing error incorrect syntax error. We are in deep problem [word replaced] [Removed Identity of organization and few unrelated stuff ]“ I have replied to my client and helped them fixed the problem. What really came to my attention is the concept of disabling clustered index. Let us try to learn a lesson from this experience. In this case, there was no need to disable clustered index at all. I had done necessary work when I was called in to work on tuning project. I had removed unused indexes, created few optimal indexes and wrote a script to disable few selected high cost indexes when bulk insert (and similar) operations are performed. There was another script which rebuild all the indexes as well. The solution worked till they included clustered index in disabling the script. Clustered indexes are in fact original table (or heap) physically ordered (any more things – not scope of this article) according to one or more keys(columns). When clustered index is disabled data rows of the disabled clustered index cannot be accessed. This means there will be no insert possible. When non clustered indexes are disabled all the data related to physically deleted but the definition of the index is kept in the system. Due to the same reason even reorganization of the index is not possible till the clustered index (which was disabled) is rebuild. Now let us come to the second part of the question, regarding receiving the error when clustered index is ‘enabled’. This is very common question I receive on the blog. (The following statement is written keeping the syntax of T-SQL in mind) Clustered indexes can be disabled but can not be enabled, they have to rebuild. It is intuitive to think that something which we have ‘disabled’ can be ‘enabled’ but the syntax for the same is ‘rebuild’. This issue has been explained here: SQL SERVER – How to Enable Index – How to Disable Index – Incorrect syntax near ‘ENABLE’. Let us go over this example where inserting the data is not possible when clustered index is disabled. USE AdventureWorks GO -- Create Table CREATE TABLE [dbo].[TableName]( [ID] [int] NOT NULL, [FirstCol] [varchar](50) NULL, CONSTRAINT [PK_TableName] PRIMARY KEY CLUSTERED ([ID] ASC) ) GO -- Create Nonclustered Index CREATE UNIQUE NONCLUSTERED INDEX [IX_NonClustered_TableName] ON [dbo].[TableName] ([FirstCol] ASC) GO -- Populate Table INSERT INTO [dbo].[TableName] SELECT 1, 'First' UNION ALL SELECT 2, 'Second' UNION ALL SELECT 3, 'Third' GO -- Disable Nonclustered Index ALTER INDEX [IX_NonClustered_TableName] ON [dbo].[TableName] DISABLE GO -- Insert Data should work fine INSERT INTO [dbo].[TableName] SELECT 4, 'Fourth' UNION ALL SELECT 5, 'Fifth' GO -- Disable Clustered Index ALTER INDEX [PK_TableName] ON [dbo].[TableName] DISABLE GO -- Insert Data will fail INSERT INTO [dbo].[TableName] SELECT 6, 'Sixth' UNION ALL SELECT 7, 'Seventh' GO /* Error: Msg 8655, Level 16, State 1, Line 1 The query processor is unable to produce a plan because the index 'PK_TableName' on table or view 'TableName' is disabled. */ -- Reorganizing Index will also throw an error ALTER INDEX [PK_TableName] ON [dbo].[TableName] REORGANIZE GO /* Error: Msg 1973, Level 16, State 1, Line 1 Cannot perform the specified operation on disabled index 'PK_TableName' on table 'dbo.TableName'. */ -- Rebuliding should work fine ALTER INDEX [PK_TableName] ON [dbo].[TableName] REBUILD GO -- Insert Data should work fine INSERT INTO [dbo].[TableName] SELECT 6, 'Sixth' UNION ALL SELECT 7, 'Seventh' GO -- Clean Up DROP TABLE [dbo].[TableName] GO I hope this example is clear enough. There were few additional posts I had written years ago, I am listing them here. SQL SERVER – Enable and Disable Index Non Clustered Indexes Using T-SQL SQL SERVER – Enabling Clustered and Non-Clustered Indexes – Interesting Fact Reference : Pinal Dave (http://blog.SQLAuthority.com) Filed under: Pinal Dave, SQL, SQL Authority, SQL Constraint and Keys, SQL Query, SQL Server, SQL Tips and Tricks, T SQL, Technology

    Read the article

  • MySQL Error 1452 - Cannot add or update a child row: a foreign key constraint fails

    - by dscher
    I've looked at other people's questions on this topic but can't seem to find where my error is coming from. Any help would be greatly appreciated. I'm including as much as I can think of that might help find the problem: CREATE TABLE stocks ( id INT AUTO_INCREMENT NOT NULL, user_id INT(11) UNSIGNED NOT NULL, ticker VARCHAR(20) NOT NULL, name VARCHAR(20), rating INT(11), position ENUM("strong buy", "buy", "sell", "strong sell", "neutral"), next_look DATE, privacy ENUM("public", "private"), PRIMARY KEY(id), FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8; CREATE TABLE IF NOT EXISTS `stocks_tags` ( `stock_id` INT NOT NULL, `tag_id` INT NOT NULL, PRIMARY KEY (`stock_id`,`tag_id`), KEY `fk_stock_tag` (`tag_id`), KEY `fk_tag_stock` (`stock_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; ALTER TABLE `stocks_tags` ADD CONSTRAINT `fk_stock_tag` FOREIGN KEY (`tag_id`) REFERENCES `tags` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, ADD CONSTRAINT `fk_tag_stock` FOREIGN KEY (`stock_id`) REFERENCES `stocks` (`id`) ON DELETE CASCADE ON UPDATE CASCADE; CREATE TABLE tags( id INT AUTO_INCREMENT NOT NULL PRIMARY KEY, tags VARCHAR(30), UNIQUE(tags) ) ENGINE=INNODB DEFAULT CHARSET=utf8; And the error I'm getting: Database_Exception [ 1452 ]: Cannot add or update a child row: a foreign key constraint fails (`ddmachine`.`stocks_tags`, CONSTRAINT `fk_stock_tag` FOREIGN KEY (`tag_id`) REFERENCES `tags` (`id`) ON DELETE CASCADE ON UPDATE CASCADE) [ INSERT INTO `stocks_tags` (`stock_id`, `tag_id`) VALUES (19, 'cash') ] I did see that someone else had a similar problem based on their enum columns but don't think that's it.

    Read the article

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