Search Results

Search found 26283 results on 1052 pages for 'temporary table'.

Page 49/1052 | < Previous Page | 45 46 47 48 49 50 51 52 53 54 55 56  | Next Page >

  • UpdateModelFromDatabaseException when trying to add a table to Entity Framework model

    - by Agent_9191
    I'm running into a weird issue with Entity Framework in .NET 3.5 SP1 within Visual Studio 2008. I created a database with a few tables in SQL Server and then created the associated .edmx Entity Framework model and had no issues. I then created a new table in the database that has a foreign key to an existing table and needed to be added to the .edmx. So I opened the .edmx in Visual Studio and in the models right-clicked and chose "Update Model From Database...". I saw the new table in the "add" tab, so I checked it and clicked finish. However I get an error message with the following text: --------------------------- Microsoft Visual Studio --------------------------- An exception of type 'Microsoft.Data.Entity.Design.Model.Commands.UpdateModelFromDatabaseException' occurred while attempting to update from the database. The exception message is: 'Cannot update from the database. Cannot resolve the Name Target for ScalarProperty 'ID <==> CustomerID'.'. --------------------------- OK --------------------------- For reference, here's the tables seem to be the most pertinent to the error. CustomerPreferences already exists in the .edmx. Diets is the table that was added afterwards and trying to add to the .edmx. CREATE TABLE [dbo].[CustomerPreferences]( [ID] [uniqueidentifier] NOT NULL, [LastUpdatedTime] [datetime] NOT NULL, [LastUpdatedBy] [uniqueidentifier] NOT NULL, PRIMARY KEY CLUSTERED ( [ID] ASC )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] ) ON [PRIMARY] CREATE TABLE [dbo].[Diets]( [ID] [uniqueidentifier] NOT NULL, [CustomerID] [uniqueidentifier] NOT NULL, [Description] [nvarchar](50) NOT NULL, [LastUpdatedTime] [datetime] NOT NULL, [LastUpdatedBy] [uniqueidentifier] NOT NULL, PRIMARY KEY CLUSTERED ( [ID] ASC )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] ) ON [PRIMARY] GO ALTER TABLE [dbo].[Diets] WITH CHECK ADD CONSTRAINT [FK_Diets_CustomerPreferences] FOREIGN KEY([CustomerID]) REFERENCES [dbo].[CustomerPreferences] ([ID]) GO ALTER TABLE [dbo].[Diets] CHECK CONSTRAINT [FK_Diets_CustomerPreferences] GO This seems like a fairly common use case, so I'm not sure where I'm going wrong.

    Read the article

  • Returning the address of local or temporary variable

    - by Dave18
    #include <iostream> int& foo() { int i = 6; std::cout << &i << std::endl; return i; } int main() { int i = foo(); std::cout << &i << std::endl; } I know it doesn't return the address of local variable so that is why the warning but why does it still works and assign the variable i in main() to '6'? How does it only return the value if the variable the was removed from stack memory?

    Read the article

  • Postgresql Output column from another table

    - by muffin
    i'm using Postgresql, my question is specifically about querying from a table that's in another table and i'm really having trouble with this one. In fact, i'm absolutely mentally blocked. I'll try to define the relations of the tables as much as I can. I have a table entry which is like this: Each of the entries has a group_id; when they are 'advanced' to the next stage, the old entries are marked is_active = false, and a new assignment is done, so C & D are advanced stages of A & B. I have another table (which acts as a record keeper) , in which the storage_log_id refers to, this is the storage_log table : But then I have another table, to really find out where the entries are actually stored - storage table : To define my problem properly. Each entry has a storage_log_id (but some doesn't have yet), and a storage_log has a storage_id to refer to the actual table and find the storage label. The sql query i'm trying to do should output this one: Where The actual storage label is shown instead of the log id. This is so far what i've done: select e.id, e.group_id, e.name, e.stage, s.label from operational.entry e, operational.storage_log sl, operational.storage s where e.storage_log_id = sl.id and sl.storage_id = s.id But this just returns 3 rows, showing only the ones that have the seed_storage_log_id set; I should be able to see even those without logs, and especially the active ones. adding e.is_active = true to the condition makes the results empty. So, yeah i'm stuck. Need help, Thanks guys!

    Read the article

  • :include and table aliasing

    - by dondo
    I'm suffering from a variant of the problem described here: ActiveRecord assigns table aliases for association joins fairly unpredictably. The first association to a given table keeps the table name. Further joins with associations to that table use aliases including the association names in the path... but it is common for app developers not to know about [other] joins at coding time. In my case I'm being bitten by a toxic mix of has_many and :include. Many tables in my schema have a state column, and the has_many wants to specify conditions on that column: has_many :foo, :conditions => {:state => 1}. However, since the state column appears in many tables, I disambiguate by explicitly specifying the table name: has_many :foo, :conditions => "this_table.state = 1". This has worked fine until now, when for efficiency I want to add an :include to preload a fairly deep tree of data. This causes the table to be aliased inconsistently in different code paths. My reading of the tickets referenced above is that this problem is not and will not be fixed in Rails 2.x. However, I don't see any way to apply the suggested workaround (to specify the aliased table name explicitly in the query). I'm happy to specify the table alias explicitly in the has_many statement, but I don't see any way to do so. As such, the workaround doesn't appear applicable to this situation (nor, I presume, in many 'named_scope' scenarios). Is there a viable workaround?

    Read the article

  • Why does my table values return nil when i clearly initialized them?

    - by user3717078
    players = {} function newPlayer(name) players[name]={x = 200, y = 100} --assign each player their x and y coordinates, which is x: 200 and y: 100 end function checkPosition(name?) -- Do i need a parameter? if players[name].x == 200 and players[name].y == 100 then --says players[name].x is a nil value print("good") else print("bad") end end Error: attempt to index ? (a nil value) Current Situation: The code above says players[name].x is a nil value, I would like to know why since i thought i assigned it in the function newPlayer.

    Read the article

  • How to test if table was updated in Zend Framework?

    - by AD
    When user opens a form to modify a record, but instead of changing information, he just clicks the Update button. Which causes the update() function to return 0. However, I consider this case a valid update task. How would I test it, so I can assign a success message? Is update() returns -1 when SQL query failed or also 0? Method: Zend_Db_Table_Abstract::update() Any ideas? Thanks

    Read the article

  • Disallow taking pointer/reference to const to a temporary object in C++ (no C++0X)

    - by KRao
    Hi, I am faced with the following issue. Consider the following class: //Will be similar to bost::reference_wrapper template<class T> class Ref { public: explicit Ref(T& t) : m_ptr(&t) {} private: T* m_ptr; }; and this function returning a double double fun() {return 1.0;} If we now have double x = 1.0; const double xc = 1.0; Ref<double> ref1(x); //OK Ref<const double> refc1(cx); //OK good so far, however: //Ref<double> ref2( fun() ); //Fails as I want it to Ref<const double> refc2( fun() ); //Works but I would like it not to Is there a way to modify Ref (the way you prefer) but not the function fun, so that the last line returns a compile-time error? Please notice you can modify the constructor signature (as long as I am able to initialise the Ref as intended). Thank you in advance for your help!

    Read the article

  • Create table class as a singleton

    - by Mark
    I got a class that I use as a table. This class got an array of 16 row classes. These row classes all have 6 double variables. The values of these rows are set once and never change. Would it be a good practice to make this table a singleton? The advantage is that it cost less memory, but the table will be called from multiple threads so I have to synchronize my code which way cause a bit slower application. However lookups in this table are probably a very small portion of the total code that is executed. EDIT: This is my code, are there better ways to do this or is this a good practice? Removed synchronized keyword according to recommendations in this question. final class HalfTimeTable { private HalfTimeRow[] table = new HalfTimeRow[16]; private static final HalfTimeTable instance = new HalfTimeTable(); private HalfTimeTable() { if (instance != null) { throw new IllegalStateException("Already instantiated"); } table[0] = new HalfTimeRow(4.0, 1.2599, 0.5050, 1.5, 1.7435, 0.1911); table[1] = new HalfTimeRow(8.0, 1.0000, 0.6514, 3.0, 1.3838, 0.4295); //etc } @Override @Deprecated public Object clone() throws CloneNotSupportedException { throw new CloneNotSupportedException(); } public static HalfTimeTable getInstance() { return instance; } public HalfTimeRow getRow(int rownumber) { return table[rownumber]; } }

    Read the article

  • Problem in creating Temporary File in android?

    - by Rajapandian
    Hi, In my MediaPlayer application for streaming Video i am using the following code File temp = File.createTempFile("mediaplayertmp", "dat"); while running it throws exceptions like Parent directory of file in not writable:/sdcard/ mediaplayertmp43912.dat I dont how to handle this problem,and i want to know that when we execute that code means where the file will be created.any one knows the solution means please help with some code.

    Read the article

  • How to move positions within an array?

    - by Jade Mulholland
    A program that simply moves array elements. Two variables: userInputVariable and blankSpaceVariable. I have a 2D array named table. Defined as table[userInputVariable + 1][6] I am printing out this array in a table format, and the far left column is numbered by whatever number the user entered at the beginning of the program. I then ask the user where they would like to enter a blank space within the array. This blank space acts like a divider for all the other information in the array. For example, if the user enters 10 at the start for the userInputVariable, and then enters 5 for the blank space. Once printed, the numbers should go like this: 1, 2, 3, 4, --, 5, 6, 7, 8, 9, 10. My plan has been to create a for loop and try to move all the numbers in the array back a position starting from the blank space variable. What I currently have, but does not work: for (int i = blankSpaceVariable; i < table.length - 1; i++) { table[i] = table[i + 1]; } table[blankSpaceVariable] = "--"; With my current code, the numbers go like this: 1, 2, 3, 4, 6, 7, 8, 9, 10 Tried completing this a few different ways also, but the other info within my 2D array didn't move with the numbers. So I thought that this approach can hopefully move all the info within my 2D array down, and make way for a blank section. All help is greatly appreciated!

    Read the article

  • Add Form In Every Row with table helper Codeigniter

    - by wibi
    Hi i am creating table using table helper, but in every row i want to add form, in html like this : <table> <form action=""> <tr> <td><input type="text" name="name2"></td> </tr> </form> <form action=""> <tr> <td><input type="text" name="name2"></td> </tr> </form> </table> But i want in table helper: I have tried this one: $this->table->add_row( form_open('myAction'). form_input('name'.$i), form_submit('Submit') form_close() ); And I use firebugs to inspect element produces, like this: <table> <tr> <form action="myAction"> <td><input type="text" name="name1"></td> </form> <td><input type="submit"></td> </tr> </table> why tag doesn't show at the last tag , but show at the first tag . Thanks

    Read the article

  • C++: Life span of temporary arguments?

    - by shoosh
    When creating a new instance of a MyClass as an argument to a function like so: class MyClass { MyClass(int a); }; myFunction(MyClass(42)); does the standard make any grantees on the timing of the destructor? Specifically, can I assume that the it is going to be called before the next statement after the call to myFunction() ?

    Read the article

  • Import Data from Excel sheet to DB Table through OAF page

    - by PRajkumar
    1. Create a New Workspace and Project File > New > General > Workspace Configured for Oracle Applications File Name – PrajkumarImportxlsDemo   Automatically a new OA Project will also be created   Project Name -- ImportxlsDemo Default Package -- prajkumar.oracle.apps.fnd.importxlsdemo   2. Add JAR file jxl-2.6.3.jar to Apache Library Download jxl-2.6.3.jar from following link – http://www.findjar.com/jar/net.sourceforge.jexcelapi/jars/jxl-2.6.jar.html   Steps to add jxl.jar file in Local Machine Right Click on ImportxlsDemo > Project Properties > Libraries > Add jar/Directory and browse to directory where jxl-2.6.3.jar has been downloaded and select the JAR file            Steps to add jxl.jar file at EBS middle tier On your EBS middile tier copy jxl.jar at $FND_TOP/java/3rdparty/standalone Add $FND_TOP/java/3rdparty/standalone\jxl.jar to custom classpath in Jser.properties file which is at $IAS_ORACLE_HOME/Apache/Jserv/etc wrapper.classpath=/U01/oracle/dev/devappl/fnd/11.5.0/java/3rdparty/stdalone/jxl.jar Bounce Apache Server   3. Create a New Application Module (AM) Right Click on ImportxlsDemo > New > ADF Business Components > Application Module Name -- ImportxlsAM Package -- prajkumar.oracle.apps.fnd.importxlsdemo.server   Check Application Module Class: ImportxlsAMImpl Generate JavaFile(s)   4. Create Test Table in which we will insert data from excel CREATE TABLE xx_import_excel_data_demo (    -- --------------------      -- Data Columns      -- --------------------      column1                 VARCHAR2(100),      column2                 VARCHAR2(100),      column3                 VARCHAR2(100),      column4                 VARCHAR2(100),      column5                 VARCHAR2(100),      -- --------------------      -- Who Columns      -- --------------------      last_update_date   DATE         NOT NULL,      last_updated_by    NUMBER   NOT NULL,      creation_date         DATE         NOT NULL,      created_by             NUMBER    NOT NULL,      last_update_login  NUMBER );   5. Create a New Entity Object (EO) Right click on ImportxlsDemo > New > ADF Business Components > Entity Object Name – ImportxlsEO Package -- prajkumar.oracle.apps.fnd.importxlsdemo.schema.server Database Objects -- XX_IMPORT_EXCEL_DATA_DEMO   Note – By default ROWID will be the primary key if we will not make any column to be primary key Check the Accessors, Create Method, Validation Method and Remove Method   6. Create a New View Object (VO) Right click on ImportxlsDemo > New > ADF Business Components > View Object Name -- ImportxlsVO Package -- prajkumar.oracle.apps.fnd.importxlsdemo.server   In Step2 in Entity Page select ImportxlsEO and shuttle it to selected list In Step3 in Attributes Window select all columns and shuttle them to selected list   In Java page Uncheck Generate Java file for View Object Class: ImportxlsVOImpl Select Generate Java File for View Row Class: ImportxlsVORowImpl -> Generate Java File -> Accessors   7. Add Your View Object to Root UI Application Module Right click on ImportxlsAM > Edit ImportxlsAM > Data Model > Select ImportxlsVO and shuttle to Data Model list   8. Create a New Page Right click on ImportxlsDemo > New > Web Tier > OA Components > Page Name -- ImportxlsPG Package -- prajkumar.oracle.apps.fnd.importxlsdemo.webui   9. Select the ImportxlsPG and go to the strcuture pane where a default region has been created   10. Select region1 and set the following properties:   Attribute Property ID PageLayoutRN AM Definition prajkumar.oracle.apps.fnd.importxlsdemo.server.ImportxlsAM Window Title Import Data From Excel through OAF Page Demo Window Title Import Data From Excel through OAF Page Demo   11. Create messageComponentLayout Region Under Page Layout Region Right click PageLayoutRN > New > Region   Attribute Property ID MainRN Item Style messageComponentLayout   12. Create a New Item messageFileUpload Bean under MainRN Right click on MainRN > New > messageFileUpload Set Following Properties for New Item --   Attribute Property ID MessageFileUpload Item Style messageFileUpload   13. Create a New Item Submit Button Bean under MainRN Right click on MainRN > New > messageLayout Set Following Properties for messageLayout --   Attribute Property ID ButtonLayout   Right Click on ButtonLayout > New > Item   Attribute Property ID Go Item Style submitButton Attribute Set /oracle/apps/fnd/attributesets/Buttons/Go   14. Create Controller for page ImportxlsPG Right Click on PageLayoutRN > Set New Controller Package Name: prajkumar.oracle.apps.fnd.importxlsdemo.webui Class Name: ImportxlsCO   Write Following Code in ImportxlsCO in processFormRequest import oracle.apps.fnd.framework.OAApplicationModule; import oracle.apps.fnd.framework.OAException; import java.io.Serializable; import oracle.apps.fnd.framework.webui.OAControllerImpl; import oracle.apps.fnd.framework.webui.OAPageContext; import oracle.apps.fnd.framework.webui.beans.OAWebBean; import oracle.cabo.ui.data.DataObject; import oracle.jbo.domain.BlobDomain; public void processFormRequest(OAPageContext pageContext, OAWebBean webBean) {  super.processFormRequest(pageContext, webBean);  if (pageContext.getParameter("Go") != null)  {   DataObject fileUploadData = (DataObject)pageContext.getNamedDataObject("MessageFileUpload");   String fileName = null;                 try   {    fileName = (String)fileUploadData.selectValue(null, "UPLOAD_FILE_NAME");   }   catch(NullPointerException ex)   {    throw new OAException("Please Select a File to Upload", OAException.ERROR);   }   BlobDomain uploadedByteStream = (BlobDomain)fileUploadData.selectValue(null, fileName);   try   {    OAApplicationModule oaapplicationmodule = pageContext.getRootApplicationModule();    Serializable aserializable2[] = {uploadedByteStream};    Class aclass2[] = {BlobDomain.class };    oaapplicationmodule.invokeMethod("ReadExcel", aserializable2,aclass2);   }   catch (Exception ex)   {    throw new OAException(ex.toString(), OAException.ERROR);   }  } }     Write Following Code in ImportxlsAMImpl.java import java.io.IOException; import java.io.InputStream; import jxl.Cell; import jxl.CellType; import jxl.Sheet; import jxl.Workbook; import jxl.read.biff.BiffException; import oracle.apps.fnd.framework.server.OAApplicationModuleImpl; import oracle.jbo.Row; import oracle.apps.fnd.framework.OAViewObject; import oracle.apps.fnd.framework.server.OAViewObjectImpl; import oracle.jbo.domain.BlobDomain; public void createRecord(String[] excel_data) {   OAViewObject vo = (OAViewObject)getImportxlsVO1();            if (!vo.isPreparedForExecution())    {   vo.executeQuery();      }                      Row row = vo.createRow();  try  {   for (int i=0; i < excel_data.length; i++)   {    row.setAttribute("Column" +(i+1) ,excel_data[i]);   }  }  catch(Exception e)  {   System.out.println(e.getMessage());   }  vo.insertRow(row);  getTransaction().commit(); }      public void ReadExcel(BlobDomain fileData) throws IOException {  String[] excel_data  = new String[5];  InputStream inputWorkbook = fileData.getInputStream();  Workbook w;          try  {   w = Workbook.getWorkbook(inputWorkbook);                       // Get the first sheet   Sheet sheet = w.getSheet(0);                       for (int i = 0; i < sheet.getRows(); i++)   {    for (int j = 0; j < sheet.getColumns(); j++)    {     Cell cell = sheet.getCell(j, i);     CellType type = cell.getType();     if (cell.getType() == CellType.LABEL)     {      System.out.println("I got a label " + cell.getContents());      excel_data[j] = cell.getContents();     }     if (cell.getType() == CellType.NUMBER)     {        System.out.println("I got a number " + cell.getContents());      excel_data[j] = cell.getContents();     }    }    createRecord(excel_data);   }  }              catch (BiffException e)  {   e.printStackTrace();  } }   15. Congratulation you have successfully finished. Run Your page and Test Your Work   Consider Excel PRAJ_TEST.xls with following data --       Lets Try to import this data into DB Table --          

    Read the article

  • Windows 7 disk errors after a few hours of runtime

    - by GFK
    I'm having trouble understanding what is going on with my work PC. Whenever I boot it, it runs fine for a while, then starts to randomly show disk errors. The displayed error often contains the message "not enough storage is available to process this command", although depending on the application that fails it can be different. This has happened for weeks now and is getting worse. This is what troubles me: It never seems to impact critical parts of the system (no BSOD, no freeze). Only some applications seem impacted, refusing to function correctly after a while: Outlook 2010 cannot download RSS feeds anymore, Firefox 6 or IE9 cannot download anything bigger than 3MB without failing, Windows Update fails, all msi installers fail, Visual Studio 2010 starts failing in weird manners... It only happens after a while using it (typically 3 hours, but it seems that installing a program or compiling several times makes it shorter) Rebooting solves it (temporarily). The system: The OS is Windows 7 Pro Spanish SP1, 32 bits The system is an HP Compaq 6000 Pro with 4 GB memory (only 3.4GB usable since the system is 32bit), one 500GB hard drive. Installed applications include: Visual Studio 2010, SQL Server 2008 R2, VMWare Workstation 7, Microsoft Security Essentials, Office 2010. Shutting down all related services and processes doesn't seem to change anything. The diagnostics I've run so far: Hard drive : 465GB, 165GB free Process Explorer : physical and virtual memory seem ok (pagefile is 5.3GB, physical memory usage 70%, system commit 39%) Windows Memory diagnostic tool: OK CHKDSK returned: 488282111 KB total disk space. 281668248 KB in 265779 files. 150188 KB in 62949 indexes. 0 KB in bad sectors. 571755 KB in use by the system. The log file has occupied 65536 kilobytes. 205891920 KB available on disk. For non-spanish speakers, that means all ok. SMART diagnostic tools (DiskCheckup) report all values normal. temperatures are in the normal range (HWinfo). The event viewer doesn't seem to contain any significant message. ran CCleaner 3, without any noticeable effect. I was thinking about some file number limit (between Visual Studio projects and other applications, there are around 300.000 files on the hard drive), but I couldn't find any. It's possible there is something related with the use of the temporary folders (it's the only explanation I have for why applications fail but Windows doesn't), but I cannot confirm that. Only thing I cannot find out is if chkdsk reporting 65MB for the log is normal. It seems since Vista it always reports this. Any other cleaning/diagnostic tool you might know of? Edit: I ran several other tools since I first published the question: Seagate SeaTools (the HD manufacturer's analysis tool): complete test run OK. Intel Rapid 10.1 (the HD controller manufacturer's troubleshooting tool): the HD's ok. Microsoft Desktop Heap Monitor: Desktop Heap Information Monitor Tool (Version 8.1.2925.0) Copyright (c) Microsoft Corporation. All rights reserved. Session ID: 1 Total Desktop: ( 46464 KB - 11 desktops) WinStation\Desktop Heap Size(KB) Used Rate(%) WinSta0\Winlogon (s1) 128 3.6 WinSta0\Disconnect (s1) 64 3.8 WinSta0\Default (s1) 20480 3.0 msswindowstation\mssrestricteddesk (s0) 1024 0.2 __X78B95_89_IW__A8D9S1_42_ID (s0) 1024 0.2 Service-0x0-3e5$\Default (s0) 1024 0.6 Service-0x0-3e4$\Default (s0) 1024 0.3 Service-0x0-3e7$\Default (s0) 1024 2.1 WinSta0\Winlogon (s0) 128 1.9 WinSta0\Disconnect (s0) 64 3.8 WinSta0\Default (s0) 20480 0.0 All ok, desktop heap usage < 5% Edit 2: I tried totally resetting my account by creating a new one, logging under this new one and delete the first one (local rights and files), then logging back with this deleted account (it is a domain account). No luck. Also, I found out often the error is "not enough storage is available to process this command". Searching on the internet, I found an old troubleshooting tip (setting a registry key to raise the IRP stack limit, whatever it is) which did not change anything.

    Read the article

  • MySQL: Creating table with FK error (errno 150)

    - by Peter Bailey
    I've tried searching on this error and nothing I've found helps me, so I apologize in advance if this is a duplicate and I'm just too dumb to find it. I've created a model with MySQL Workbench and am now attempting to install it to a mysql server. Using File Export Forward Engineer SQL CREATE Script... it outputs a nice big file for me, with all the settings I ask for. I switch over to MySQL GUI Tools (the Query Browser specifically) and load up this script (note that I'm going form one official MySQL tool to another). However, when I try to actually execute this file, I get the same error over and over SQLSTATE[HY000]: General error: 1005 Can't create table './srs_dev/location.frm' (errno: 150) "OK", I say to myself, something is wrong with the location table. So I check out the definition in the output file. SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0; SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0; SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='TRADITIONAL'; -- ----------------------------------------------------- -- Table `state` -- ----------------------------------------------------- DROP TABLE IF EXISTS `state` ; CREATE TABLE IF NOT EXISTS `state` ( `state_id` INT NOT NULL AUTO_INCREMENT , `iso_3166_2_code` VARCHAR(2) NOT NULL , `name` VARCHAR(60) NOT NULL , PRIMARY KEY (`state_id`) ) ENGINE = InnoDB; -- ----------------------------------------------------- -- Table `brand` -- ----------------------------------------------------- DROP TABLE IF EXISTS `brand` ; CREATE TABLE IF NOT EXISTS `brand` ( `brand_id` INT UNSIGNED NOT NULL AUTO_INCREMENT , `name` VARCHAR(45) NOT NULL , `domain` VARCHAR(45) NOT NULL , `manager_name` VARCHAR(100) NULL , `manager_email` VARCHAR(255) NULL , PRIMARY KEY (`brand_id`) ) ENGINE = InnoDB; -- ----------------------------------------------------- -- Table `location` -- ----------------------------------------------------- DROP TABLE IF EXISTS `location` ; CREATE TABLE IF NOT EXISTS `location` ( `location_id` INT UNSIGNED NOT NULL AUTO_INCREMENT , `name` VARCHAR(255) NOT NULL , `address_line_1` VARCHAR(255) NULL , `address_line_2` VARCHAR(255) NULL , `city` VARCHAR(100) NULL , `state_id` TINYINT UNSIGNED NULL DEFAULT NULL , `postal_code` VARCHAR(10) NULL , `phone_number` VARCHAR(20) NULL , `fax_number` VARCHAR(20) NULL , `lat` DECIMAL(9,6) NOT NULL , `lng` DECIMAL(9,6) NOT NULL , `contact_url` VARCHAR(255) NULL , `brand_id` TINYINT UNSIGNED NOT NULL , `summer_hours` VARCHAR(255) NULL , `winter_hours` VARCHAR(255) NULL , `after_hours_emergency` VARCHAR(255) NULL , `image_file_name` VARCHAR(100) NULL , `manager_name` VARCHAR(100) NULL , `manager_email` VARCHAR(255) NULL , `created_date` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP , PRIMARY KEY (`location_id`) , CONSTRAINT `fk_location_state` FOREIGN KEY (`state_id` ) REFERENCES `state` (`state_id` ) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT `fk_location_brand` FOREIGN KEY (`brand_id` ) REFERENCES `brand` (`brand_id` ) ON DELETE NO ACTION ON UPDATE NO ACTION) ENGINE = InnoDB; CREATE INDEX `fk_location_state` ON `location` (`state_id` ASC) ; CREATE INDEX `fk_location_brand` ON `location` (`brand_id` ASC) ; CREATE INDEX `idx_lat` ON `location` (`lat` ASC) ; CREATE INDEX `idx_lng` ON `location` (`lng` ASC) ; Looks ok to me. I surmise that maybe something is wrong with the Query Browser, so I put this file on the server and try to load it this way ] mysql -u admin -p -D dbname < path/to/create_file.sql And I get the same error. So I start to Google this issue and find all kinds of accounts that talk about an error with InnoDB style tables that fail with foreign keys, and the fix is to add "SET FOREIGN_KEY_CHECKS=0;" to the SQL script. Well, as you can see, that's already part of the file that MySQL Workbench spat out. So, my question is then, why is this not working when I'm doing what I think I'm supposed to be doing? Version Info: # MySQL: 5.0.45 GUI Tools: 1.2.17 Workbench: 5.0.30

    Read the article

  • Table Name is null in the sqlite database in android device

    - by Mahe
    I am building a simple app which stores some contacts and retrieves contacts in android phone device. I have created my own database and a table and inserting the values to the table in phone. My phone is not rooted. So I cannot access the files, but I see that values are stored in the table. And tested on a emulator also. Till here it is fine. Display all the contacts in a list by fetching data from table. This is also fine. But the problem is When I am trying to delete the record, it shows the table name is null in the logcat(not an exception), and the data is not deleted. But in emulator the data is getting deleted from table. I am not able to achieve this through phone. This is my code for deleting, public boolean onContextItemSelected(MenuItem item) { super.onContextItemSelected(item); AdapterView.AdapterContextMenuInfo info = (AdapterView.AdapterContextMenuInfo) item .getMenuInfo(); int menuItemIndex = item.getItemId(); String[] menuItems = getResources().getStringArray(R.array.menu); String menuItemName = menuItems[menuItemIndex]; String listItemName = Customers[info.position]; if (item.getTitle().toString().equalsIgnoreCase("Delete")) { Toast.makeText( context, "Selected List item is: " + listItemName + "MenuItem is: " + menuItemName, Toast.LENGTH_LONG).show(); DB = context.openOrCreateDatabase("CustomerDetails.db", MODE_PRIVATE, null); try { int pos = info.position; pos = pos + 1; Log.d("", "customers[pos]: " + Customers[info.position]); Cursor c = DB .rawQuery( "Select customer_id,first_name,last_name from CustomerInfo", null); int rowCount = c.getCount(); DB.delete(Table_name, "customer_id" + "=" + String.valueOf(pos), null); DB.close(); Log.d("", "" + String.valueOf(pos)); Toast.makeText(context, "Deleted Customer", Toast.LENGTH_LONG) .show(); // Customers[info.position]=null; getCustomers(); } catch (Exception e) { Toast.makeText(context, "Delete unsuccessfull", Toast.LENGTH_LONG).show(); } } this is my logcat, 07-02 10:12:42.976: D/Cursor(1560): Database path: CustomerDetails.db 07-02 10:12:42.976: D/Cursor(1560): Table name : null 07-02 10:12:42.984: D/Cursor(1560): Database path: CustomerDetails.db 07-02 10:12:42.984: D/Cursor(1560): Table name : null Don't know the reason why data is not being deleted. Data exists in the table. This is the specification I have given for creating the table public static String customer_id="customer_id"; public static String site_id="site_id"; public static String last_name="last_name"; public static String first_name="first_name"; public static String phone_number="phone_number"; public static String address="address"; public static String city="city"; public static String state="state"; public static String zip="zip"; public static String email_address="email_address"; public static String custlat="custlat"; public static String custlng="custlng"; public static String Table_name="CustomerInfo"; final SQLiteDatabase DB = context.openOrCreateDatabase( "CustomerDetails.db", MODE_PRIVATE, null); final String CREATE_TABLE = "create table if not exists " + Table_name + " (" + customer_id + " integer primary key autoincrement, " + first_name + " text not null, " + last_name + " text not null, " + phone_number+ " integer not null, " + address+ " text not null, " + city+ " text not null, " + state+ " text not null, " + zip+ " integer not null, " + email_address+ " text not null, " + custlat+ " double, " + custlng+ " double " +" );"; DB.execSQL(CREATE_TABLE); DB.close(); Please correct my code. I am struggling from two days. Any help is appreciated!!

    Read the article

  • Eager Loading more than 1 table in LinqtoSql

    - by Michael Freidgeim
    When I've tried in Linq2Sql to load table with 2 child tables, I've noticed, that multiple SQLs are generated. I've found that  it isa known issue, if you try to specify more than one to pre-load it just  picks which one to pre-load and which others to leave deferred (simply ignoring those LoadWith hints)There are more explanations in http://codebetter.com/blogs/david.hayden/archive/2007/08/06/linq-to-sql-query-tuning-appears-to-break-down-in-more-advanced-scenarios.aspxThe reason the relationship in your blog post above is generating multiple queries is that you have two (1:n) relationship (Customers->Orders) and (Orders->OrderDetails). If you just had one (1:n) relationship (Customer->Orders) or (Orders->OrderDetails) LINQ to SQL would optimize and grab it in one query (using a JOIN).  The alternative -to use SQL and POCO classes-see http://stackoverflow.com/questions/238504/linq-to-sql-loading-child-entities-without-using-dataloadoptions?rq=1Fortunately the problem is not applicable to Entity Framework, that we want to use in future development instead of Linq2SqlProduct firstProduct = db.Product.Include("OrderDetail").Include("Supplier").First(); ?

    Read the article

  • Impact of Truncate or Drop Table When Flashback Database is Enabled

    - by alejandro.vargas
    Recently I was working on a VLDB on the implementation of a disaster recovery environment configured with data guard physical standby and fast start failover. One of the questions that come up was about the overhead of truncating and dropping tables. There are daily jobs on the database that truncate extremely large partitions, and as note 565535.1 explains, we knew there is an overhead for these operations. But the information on the note was not clear enough, we the additional information I've got from Senior Oracle colleagues I did compile this document "Impact of Truncate or Drop Table When Flashback Database is Enabled" that further explain the case

    Read the article

  • Tips for adapting Date table to Power View forecasting #powerview #powerbi

    - by Marco Russo (SQLBI)
    During the keynote of the PASS Business Analytics Conference, Amir Netz presented the new forecasting capabilities in Power View for Office 365. I immediately tried the new feature (which was immediately available, a welcome surprise in a Microsoft announcement for a new release) and I had several issues trying to use existing data models. The forecasting has a few requirements that are not compatible with the “best practices” commonly used for a calendar table until this announcement. For example, if you have a Year-Month-Day hierarchy and you want to display a line chart aggregating data at the month level, you use a column containing month and year as a string (e.g. May 2014) sorted by a numeric column (such as 201405). Such a column cannot be used in the x-axis of a line chart for forecasting, because you need a date or numeric column. There are also other requirements and I wrote the article Prepare Data for Power View Forecasting in Power BI on SQLBI, describing how to create columns that can be used with the new forecasting capabilities in Power View for Office 365.

    Read the article

  • Architecture: Bringing Value to the Table

    - by Bob Rhubart
    A recent TechTarget article features an interview with Business Architecture expert William Ulrich (Take a business-driven approach to application modernization ). In that article Ulrich offers this advice: "Moving from one technical architecture might be perfectly viable on a project by project basis, but when you're looking at the big picture and you want to really understand how to drive business value so that the business is pushing money into IT instead of IT pulling money back, you have to understand the business architecture. When we do that we're going to really be able to start bringing value to the table." In many respects that big picture view is what software architecture is all about. As an architect, your technical skills must be top-notch. But if you don't apply that technical knowledge within the larger context of moving the business forward, what are you accomplishing? If you're interested in more insight from William Ulrich, you can listen to the ArchBeat Podcast interview he did last year, in which he and co-author Neal McWhorter talked about their book, Business Architecture: The Art and Practice of Business Transformation.

    Read the article

  • SQL SERVER – Retrieving Random Rows from Table Using NEWID()

    - by pinaldave
    I have previously written about how to get random rows from SQL Server. SQL SERVER – Generate A Single Random Number for Range of Rows of Any Table – Very interesting Question from Reader SQL SERVER – Random Number Generator Script – SQL Query However, I have not blogged about following trick before. Let me share the trick here as well. You can generate random scripts using following methods as well. USE AdventureWorks2012 GO -- Method 1 SELECT TOP 100 * FROM Sales.SalesOrderDetail ORDER BY NEWID() GO -- Method 2 SELECT TOP 100 * FROM Sales.SalesOrderDetail ORDER BY CHECKSUM(NEWID()) GO You will notice that using NEWID() in the ORDER BY will return random rows in the result set. How many of you knew this trick? You can run above script multiple times and it will give random rows every single time. Reference: Pinal Dave (http://blog.sqlauthority.com)   Filed under: PostADay, SQL, SQL Authority, SQL Function, SQL Query, SQL Server, SQL Tips and Tricks, T SQL, Technology

    Read the article

  • Tips for adapting Date table to Power View forecasting #powerview #powerbi

    - by Marco Russo (SQLBI)
    During the keynote of the PASS Business Analytics Conference, Amir Netz presented the new forecasting capabilities in Power View for Office 365. I immediately tried the new feature (which was immediately available, a welcome surprise in a Microsoft announcement for a new release) and I had several issues trying to use existing data models. The forecasting has a few requirements that are not compatible with the “best practices” commonly used for a calendar table until this announcement. For example, if you have a Year-Month-Day hierarchy and you want to display a line chart aggregating data at the month level, you use a column containing month and year as a string (e.g. May 2014) sorted by a numeric column (such as 201405). Such a column cannot be used in the x-axis of a line chart for forecasting, because you need a date or numeric column. There are also other requirements and I wrote the article Prepare Data for Power View Forecasting in Power BI on SQLBI, describing how to create columns that can be used with the new forecasting capabilities in Power View for Office 365.

    Read the article

  • How Would You Design This Table?

    - by sooprise
    I have to create a table where each row needs to store 50 number values. Each row will always need to store 50 number values. If this was a smaller number of values, I would just make fields for each of the values, but because there are 50, this approach seems a bit cumbersome (but since it will always be 50 values, maybe this is the correct approach?). Is there a way to store an array of values in a field? This seems like a nice solution, but the concept is almost identical to creating a relational database.

    Read the article

  • My coworker created a 96 columns SQL table

    - by Eric
    Here we are in 2010, software engineers with 4 or 5 years or experience, still designing tables with 96 fracking columns. I told him it's gonna be a nightmare. I showed him that we have to use ordinals to interface MySQL with C#. I explained that tables with more columns than rows are a huge smell. Still, I get the "It's going to be simpler this way". What should I do? EDIT * This table contains data from sensors. We have sensor 1 with Dynamic_D1X Dynamic_D1Y [...] Dynamic_D6X Dynamic_D6Y [...]

    Read the article

< Previous Page | 45 46 47 48 49 50 51 52 53 54 55 56  | Next Page >