Search Results

Search found 31606 results on 1265 pages for 'generate table'.

Page 14/1265 | < Previous Page | 10 11 12 13 14 15 16 17 18 19 20 21  | Next Page >

  • How do I execute a sql statement through a variable (dyname sql) that tries to do an insert into a variable table?

    - by Testifier
    If I do what I wanna do with a TEMPORARY TABLE, it works fine: DECLARE @CTRFR VARCHAR(MAX) SET @CTRFR = 'select blah blah blah' -- <-- very long select statement. this returns a 0 or some greater number. Please note! --> I NEED THIS NUMBER. IF EXISTS ( SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo][#CTRFRResult]') AND type IN ( N'U' ) ) DROP TABLE [dbo].[#CTRFRResult] CREATE TABLE #CTRFRResult ( CTRFRResult VARCHAR(MAX) ) SET @CTRFR = 'insert into #CTRFRResult ' + @CTRFR EXEC(@CTRFR) The above works fine. The problem is that several databases are using the same TEMP table. Therefore I need to use a VARIABLE table (instead of a temporary table). What I have below is not working because it says that the table must be declared. DECLARE @CTRFRResult TABLE ( CTRFRResult VARCHAR(MAX) ) SET @CTRFR = 'insert into @CTRFRResult ' + @CTRFR -- I think the issue is here. EXEC(@CTRFR) Setting @CTRFR to 'insert into...' is not working because I'm assuming the table name is out of scope. How would I go about mimicking the temporary table code using a variable table?

    Read the article

  • PHP while loop, table row

    - by Elliott
    Hi, I'm trying to loop through a database and output data into a div, if there are 3 divs horizontally accross it will the start a new tr until it reaches another 3 etc. It is currently outputted like : [] [] [] [] [] [] Currently I have it working when it reaches 3 it starts a new row, but I don't know how I can only echo a new tr once? As it creates a new table row each time. echo '<table><tr>'; while ($result) { $i ++; if ($i&3) { echo '<td> <div>Row Data</div> </td>'; } else { echo '<tr> <td> <div>Row Data</div> </td></tr>'; } } echo '</tr></table>'; The $result variable is the recordset from my sql query, everything works fine I just don't know how to only create a new table row once? Thanks

    Read the article

  • Using data.table to aggregate

    - by dayne
    After multiple suggestions from SO users, I am finally trying to convert my code over to using data.tables. library(data.table) DT <- data.table(plate = paste0("plate",rep(1:2,each=5)), id = rep(c("CTRL","CTRL","ID1","ID2","ID3"),2), val = 1:10) > DT plate id val 1: plate1 CTRL 1 2: plate1 CTRL 2 3: plate1 ID1 3 4: plate1 ID2 4 5: plate1 ID3 5 6: plate2 CTRL 6 7: plate2 CTRL 7 8: plate2 ID1 8 9: plate2 ID2 9 10: plate2 ID3 10 What I would like to do is take the average of DT[,val] by plate when the id is "CTRL". I would normally aggregate the data frame, then use match to map the values back to a new column, 'ctrl'. Using the data.table package I can get: DT[id=="CTRL",ctrl:=mean(val),by=plate] > DT plate id val ctrl 1: plate1 CTRL 1 1.5 2: plate1 CTRL 2 1.5 3: plate1 ID1 3 NA 4: plate1 ID2 4 NA 5: plate1 ID3 5 NA 6: plate2 CTRL 6 6.5 7: plate2 CTRL 7 6.5 8: plate2 ID1 8 NA 9: plate2 ID2 9 NA 10: plate2 ID3 10 NA What I need is really: DT <- data.table(plate = paste0("plate",rep(1:2,each=5)), id = rep(c("CTRL","CTRL","ID1","ID2","ID3"),2), val = 1:10, ctrl = rep(c(1.5,6.5),each=5)) > DT plate id val ctrl 1: plate1 CTRL 1 1.5 2: plate1 CTRL 2 1.5 3: plate1 ID1 3 1.5 4: plate1 ID2 4 1.5 5: plate1 ID3 5 1.5 6: plate2 CTRL 6 6.5 7: plate2 CTRL 7 6.5 8: plate2 ID1 8 6.5 9: plate2 ID2 9 6.5 10: plate2 ID3 10 6.5 Eventually I would like to use much more complicated selections of the values, but I do not know how to select specific values, run some function, then map those values back to the appropriate row using data frames.

    Read the article

  • SQL SERVER – How to an Add Identity Column to Table in SQL Server

    - by Pinal Dave
    Here is the question I received on SQLAuthority Fan Page. “How do I add an identity column to Table in SQL Server? “ Sometime the questions are very very simple but the answer is not easy to find. Scenario 1: If you are table does not have identity column, you can simply add the identity column by executing following script: ALTER TABLE MyTable ADD ID INT IDENTITY(1,1) NOT NULL Scenario 2: If your table already has a column which you want to convert to identity column, you can’t do that directly. There is a workaround for the same which I have discussed in depth over the article Add or Remove Identity Property on Column. Scenario 3: If your table has already identity column and you can want to add another identity column for any reason – that is not possible. A table can have only one identity column. If you try to have multiple identity column your table, it will give following error. Msg 2744, Level 16, State 2, Line 2 Multiple identity columns specified for table ‘MyTable‘. Only one identity column per table is allowed. Leave a comment if you have any suggestion. Reference : Pinal Dave (http://blog.SQLAuthority.com) Filed under: PostADay, SQL, SQL Authority, SQL Query, SQL Server, SQL Tips and Tricks, T SQL Tagged: Identity

    Read the article

  • Hibernate: Parent/Child relationship in a single-table

    - by Dee
    I hardly see any pointer on the following problem related to Hibernate. This pertains to implementing inheritance using a single database table with a parent-child relationship to itself. For example: CREATE TABLE Employee ( empId BIGINT NOT NULL AUTO_INCREMENT, empName VARCHAR(100) NOT NULL, managerId BIGINT, CONSTRAINT pk_employee PRIMARY KEY (empId) ) Here, the managerId column may be null, or may point to another row of the Employee table. Business rule requires the Employee to know about all his reportees and for him to know about his/her manager. The business rules also allow rows to have null managerId (the CEO of the organisation doesn't have a manager). How do we map this relationship in Hibernate, standard many-to-one relationship doesn't work here? Example code would be appreciated.

    Read the article

  • Hibernate: Parent/Child relationship in a single-table

    - by Dee
    I hardly see any pointer on the following problem related to Hibernate. This pertains to implementing inheritance using a single database table with a parent-child relationship to itself. For example: CREATE TABLE Employee ( empId BIGINT NOT NULL AUTO_INCREMENT, empName VARCHAR(100) NOT NULL, managerId BIGINT, CONSTRAINT pk_employee PRIMARY KEY (empId) ) Here, the managerId column may be null, or may point to another row of the Employee table. Business rule requires the Employee to know about all his reportees and for him to know about his/her manager. The business rules also allow rows to have null managerId (the CEO of the organisation doesn't have a manager). How do we map this relationship in Hibernate, standard many-to-one relationship doesn't work here? Example code would be appreciated.

    Read the article

  • Gap after table in LaTex

    - by Tim
    Hi, I notice that there is some gap after my table. See the following snapshot: http://i42.tinypic.com/23rkdn6.jpg My Latex code is: \begin{table}[htb] \caption{Error rates VS training size in AdaBoosted stump, SVM and kNN. \label{tab:examplecount8000errerrplot}} \begin{center} \begin{tabular}{c c} \includegraphics[scale=0.4]{../boost.eps} & \includegraphics[scale=0.4]{../svm.eps} \\ \includegraphics[scale=0.4]{../knn.eps} & \\ \end{tabular} \end{center} \end{table} % \subsection{Feature Numbers} Is the gap normal or How can I reduce the gap to be normal? Thanks and regards!

    Read the article

  • MySQL: Can the table comment length be increased?

    - by Victor Kimura
    I read the MySQL comment length questions on StackOverflow here: http://stackoverflow.com/questions/391323/table-comment-length-in-mysql http://stackoverflow.com/questions/2473934/how-to-increase-mysql-table-comments-length The first link suggests that it can be done and the second suggests it cannot. I don't know why there is this limitation as the comments are very useful. Imagine if there was a limit of 60 characters for your programs. I wrote about this on my site and have some snapshots to the phpMyAdmin and Dbforge MySQL IDEs: http://mysql.tutorialref.com/mysql-table-comment-length-limit.html Is there a way to change this in phpMyAdmin or perhaps even on the CLI? There is a bug commit report from MySQL on this particular problem (follow the first StackOverflow link). It seems to state that the length problem is fixed. I have MySQL 5.1.42. Thank you, Victor

    Read the article

  • How to create following Pivot table ?

    - by Vamshi
    Hi! Can we create pivot table with Multiple columns and each column contains multiple rows. For example........... Database Table: BatchID BatchName Chemical Value -------------------------------------------------------- BI-1 BN-1 CH-1 1 BI-2 BN-2 CH-2 2 -------------------------------------------------------- This is the table , i need to display like below in Excel Sheet BI-1 BI-2 BN-1 BN-2 ------------------------------------------ CH-1 1 null ------------------------------------------ CH-2 null 2 ------------------------------------------ Here BI-1,BN-1 are two rows in a single columns i need to display chemical value as row of that. Could Please help me to solve this problem. Thank You.

    Read the article

  • How to stretch a table over multiple pages.

    - by lexu
    I have a Table (multiple rows, multiple columns, see below ) that is longer than one page. How can I tell LaTeX to continue on the next page. Adding a \newpage didn't work Manualy 'ending' and 'reopening' the table works, but is very tedious, since the table will be many pages long. \begin{tabular}{lp{13cm}} AAAAAAAAAA & FOOBAR FOOBAR FOOBAR FOOBAR FOOBAR\ BBBBBBBBBB & FOOBAR FOOBAR FOOBAR FOOBAR FOOBAR\ CCCCCCCCCC & FOOBAR FOOBAR FOOBAR FOOBAR FOOBAR\ ... ZZZZZZZZZ & FOOBAR FOOBAR FOOBAR FOOBAR FOOBAR\\ \end{tabular}

    Read the article

  • Use XSLT to arrange a list of items in a table

    - by Mark Sp
    I have a linear list of items which I wish to arrange in a table using XSLT. I wish to specify the number of columns as a parameter. For example, if I have a list of 12 items, I can select a 2x6, 3x4, 4x3 or 6x2 table. I cannot see a general way to do this. I have seen this article: http://www.nedcomp.nl/support/origdocs/xml4/extracted/xpath_hdi_1_4llx.aspx It tells you how to generate a table with a specific number of columns, but does not allow a general case. (Ideally there would be a loop for the xsl:value-of lines). Thanks Mark

    Read the article

  • Hibernate error: cannot resolve table

    - by Roman
    I'm trying to make work the example from hibernate reference. I've got simple table Pupil with id, name and age fields. I've created correct (as I think) java-class for it according to all java-beans rules. I've created configuration file - hibernate.cfg.xml, just like in the example from reference. I've created hibernate mapping for one class Pupil, and here is the error occured. <hibernate-mapping> <class name="Pupil" table="pupils"> ... </class> </hibernate-mapping> table="pupils" is red in my IDE and I see message "cannot resolve table pupils". I've also founded very strange note in reference which says that most users fail with the same problem trying to run the example. Ah.. I'm very angry with this example.. IMHO if authors know that there is such problem they should add some information about it. But, how should I fix it? I don't want to deal with Ant here and with other instruments used in example. I'm using MySql 5.0, but I think it doesn't matter. UPD: source code Pupil.java - my persistent class package domain; public class Pupil { private Integer id; private String name; private Integer age; protected Pupil () { } public Pupil (String name, int age) { this.age = age; this.name = name; } public Integer getId () { return id; } public void setId (Integer id) { this.id = id; } public String getName () { return name; } public void setName (String name) { this.name = name; } public Integer getAge () { return age; } public void setAge (Integer age) { this.age = age; } public String toString () { return "Pupil [ name = " + name + ", age = " + age + " ]"; } } Pupil.hbm.xml is mapping for this class <?xml version="1.0"?> <!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd"> <hibernate-mapping package="domain" > <class name="Pupil" table="pupils"> <id name="id"> <generator class="native" /> </id> <property name="name" not-null="true"/> <property name="age"/> </class> </hibernate-mapping> hibernate.cfg.xml - configuration for hibernate <hibernate-configuration> <session-factory> <!-- Database connection settings --> <property name="connection.driver_class">com.mysql.jdbc.Driver</property> <property name="connection.url">jdbc:mysql://localhost/hbm_test</property> <property name="connection.username">root</property> <property name="connection.password">root</property> <property name="connection.pool_size">1</property> <property name="dialect">org.hibernate.dialect.MySQL5Dialect</property> <property name="current_session_context_class">thread</property> <property name="show_sql">true</property> <mapping resource="domain/Pupil.hbm.xml"/> </session-factory> </hibernate-configuration> HibernateUtils.java package utils; import org.hibernate.SessionFactory; import org.hibernate.HibernateException; import org.hibernate.cfg.Configuration; public class HibernateUtils { private static final SessionFactory sessionFactory; static { try { sessionFactory = new Configuration ().configure ().buildSessionFactory (); } catch (HibernateException he) { System.err.println (he); throw new ExceptionInInitializerError (he); } } public static SessionFactory getSessionFactory () { return sessionFactory; } } Runner.java - class for testing hibernate import org.hibernate.Session; import java.util.*; import utils.HibernateUtils; import domain.Pupil; public class Runner { public static void main (String[] args) { Session s = HibernateUtils.getSessionFactory ().getCurrentSession (); s.beginTransaction (); List pups = s.createQuery ("from Pupil").list (); for (Object obj : pups) { System.out.println (obj); } s.getTransaction ().commit (); HibernateUtils.getSessionFactory ().close (); } } My libs: antlr-2.7.6.jar, asm.jar, asm-attrs.jar, cglib-2.1.3.jar, commons-collections-2.1.1.jar, commons-logging-1.0.4.jar, dom4j-1.6.1.jar, hibernate3.jar, jta.jar, log4j-1.2.11.jar, mysql-connector-java-5.1.7-bin.jar Compile error: cannot resolve table pupils

    Read the article

  • BeautifulSoup: Get the contents of a specific table

    - by Adam Matan
    Hi, My local airport disgracefully blocks users without IE, and looks awful. I want to write a Python scripts that would get the contents of the Arrival and Departures pages every few minutes, and show them in a more readable manner. My tools of choice are mechanize for cheating the site to believe I use IE, and BeautifulSoup for parsing page to get the flights data table. Quite honestly, I got lost in the BeautifulSoup documentation, and can't understand how to get the table (whose title I know) from the entire document, and how to get a list of rows from that table. Any ideas? Adam

    Read the article

  • SQL Server Import table keeping default values

    - by Chrissi
    I am importing a table from one database to another in SQL Server 2008 by right-clicking the target database and choosing Tasks Import Data... When I import the table I get the column names and types and all the data fine, but I lose the primary key, identity specifications and all the default values that were set in the source table. So now I have to set all the default values for each column again manually. Is there any way to get the default values with the import, or even after with a Query? I am VERY new to this and flailing in the dark, so forgive me if this is a really stupid question...

    Read the article

  • wide and long table in latex

    - by Tim
    Hi, I have a wide and long table. I am not sure how to put it in my thesis. Since it is wide, sidewaystable may be the choice. Meanwhile it is also to long to fit in one page, so longtable comes into my mind. However, I cannot make sideaystable and longtable working together for one table, e.g. \begin{sidewaystable} \begin{longtable}{| c ||c| c| c |c| c|| c |c| c|c|c| } \caption{A glance of images.} \centering % table content \end{longtable} \end{sidewaystable} What shall I do? Thanks and regards!

    Read the article

  • SQLite table creation date

    - by legr3c
    Is there a way to query the creation date of a table in SQLite? I am new to SQL, overall. I just found this http://stackoverflow.com/questions/1171019/sql-server-table-creation-date-query. I am assuming that sqlite_master is the equivalent to sys.tables in SQLite. Is that correct? But then my sqlite_master table only has the columns "type", "name", "tbl_name", "rootpage" and "sql". If this is not possible in SQLite, what would be the best way to implement this functionality by myself?

    Read the article

  • SQL query to return data from two separate rows in a table joined to a master table

    - by Ali
    I have a TWO tables of data with following fields table1=(ITTAG,ITCODE,ITDESC,SUPcode) table2=(ACCODE,ACNAME,ROUTE,SALMAN) This is my customer master table that contains my customer data such as customer code, customer name and so on... Every Route has a supervisor (table1=supcode) and I need to know the supervisor name in my table which both supervisor name and code exist in one table. table1 has contain all names separated by ITTAG. For example, supervisor's name has ITTAG='K'; also salesman's name has ITTAG='S'. ITTAG ITCODE ITDESC SUPCODE ------ ------ ------ ------- S JT JOHN TOMAS TF K WK VIKI KOO NULL Now this is the result which I want ACCODE ACNAME ROUTE SALEMANNAME SUPERVISORNAME ------- ------ ------ ------------ --------------- IMC1010 ABC HOTEL 01 JOHN TOMAS VIKI KOO I hope this this information is sufficient to get the query..

    Read the article

  • jQuery add border to table.

    - by Kyle Sevenoaks
    Hi, I'm a jQuery noob, I tried this: <input value="1" type="checkbox" name="mytable" id="checkbox2" style="float:left;" /> {literal} <script src="http://code.jquery.com/jquery-latest.js"></script> <script type="text/javascript"> $(function() { //checkbox $(".mytable").click(function(){ $(".mytable").toggleClass('mytableborders'); }); }); </script> {/literal} <table class="mytable" id="cart">....</table> But it doesn't work, I want the checkbox to change the class of the table from .mytable to .mytableborders. Thanks :)

    Read the article

  • Resetting AUTO_INCREMENT on myISAM without rebuilding the table

    - by Artem
    Please help I am in major trouble with our production database. I had accidentally inserted a key with a very large value into an autoincrement column, and now I can't seem to change this value without a huge rebuild time. "ALTER TABLE tracks_copy AUTO_INCREMENT = 661482981" Is super-slow. How can I fix this in production? I can't get this to work either (has no effect): myisamchk tracks.MYI --set-auto-increment=661482982 Any ideas? Basically, no matter what I do I get an overflow: SHOW CREATE TABLE tracks CREATE TABLE tracks ( ... ) ENGINE=MYISAM AUTO_INCREMENT=2147483648 DEFAULT CHARSET=latin1

    Read the article

  • MySQL multi CREATE TABLE syntax help?

    - by rlb.usa
    Hi guys, I'm trying to write a MySQL script that creates several tables. I have: CREATE TABLE `DataBase1`.`tbl_this`( ... ); CREATE TABLE `DataBase1`.`tbl_that`( ... ); ... (14 more) ... BUT, only the first CREATE TABLE statement is executed. I get no syntax errors. Erm, am I missing the MSSQL equivalent of GO ? What am I doing wrong here; how do I get this baby to run all the tables?

    Read the article

  • How to handle large table in MySQL ?

    - by Frantz Miccoli
    I've a database used to store items and properties about these items. The number of properties is extensible, thus there is a join table to store each property associated to an item value. CREATE TABLE `item_property` ( `property_id` int(11) NOT NULL, `item_id` int(11) NOT NULL, `value` double NOT NULL, PRIMARY KEY (`property_id`,`item_id`), KEY `item_id` (`item_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; This database has two goals : storing (which has first priority and has to be very quick, I would like to perform many inserts (hundreds) in few seconds), retrieving data (selects using item_id and property_id) (this is a second priority, it can be slower but not too much because this would ruin my usage of the DB). Currently this table hosts 1.6 billions entries and a simple count can take up to 2 minutes... Inserting isn't fast enough to be usable. I'm using Zend_Db to access my data and would really be happy if you don't suggest me to develop any php side part. Thanks for your advices !

    Read the article

  • PHP Doctrine 1.2 table names

    - by Ofir
    I'm trying to upgrade my doctrine ORM from 1.1.6 to 1.2.1 but i've enountered a BC issue with table names. Some of my table names have several words (e.g. t_foo_bar for class FooBar) where the t_ prefix is generated automatically with: $manager->setAttribute(Doctrine_Core::ATTR_TBLNAME_FORMAT, 't_%s'); This worked well in previous versions. In 1.2.1 however, it looks like doctrine is looking for t_foobar (instead of t_foo_bar with an underscore). Do you know how to solve this without changing the table names?

    Read the article

  • Sqlite + Java: table not updating

    - by Ben L
    I'm using a Java wrapper for SQLite called SQLiteJDBC - this may have some bearing on any answers... I have a table which I've displayed in a GUI, within that UI I have a button for the fields for an individual row of that table. When I save my changes I do this... Statement stmt = connection.createStatement(); stmt.execute("update 'tableName' set 'fieldName'=1 where userid=1"); int updateCount = stmt.getUpdateCount(); My connection is valid, I get no exceptions thrown and getUpdateCount() returns '1' indicating that one row has been updated. However my table is not updated. I've spent the last few hours trying to work out what's going on but I'm not having any luck. Help!!

    Read the article

  • Trying to use table aliases in SQL...

    - by user366685
    I'm a graphic designer trying my best to understand table aliases, but it's not working. Here's what I have so far: SELECT colours.colourid AS colourid1, combinations.manufacturercolourid AS colourmanid1, colours.colourname AS colourname1, colours.colourhex AS colourhex1, combinations.qecolourid2 AS colouridqe2, colours.colourid AS colourid2, colours.colourname AS colourname2, colours.colourhex AS colourhex2, colours.colourid AS colourid3, combinations.qecolourid3 AS colouridqe3, colours.colourname AS colourname3, colours.colourhex AS colourhex3, colours.colourid AS colourid4, combinations.qecolourid4 AS colouridqe4, colours.colourname AS colourname4, colours.colourhex AS colourhex4, combinations.coloursupplierid FROM combinations INNER JOIN colours ON colours.colourid = combinations.manufacturercolourid; Now, the idea is that in the colours lookup table, the id will pull the colour code, hex and name from the lookup table so that I can pull the colour code, hex and name for the 4 colours that I'm looking for. I can get this to work, but it only pulls up the first name, code and hex and I'm just not seeing what I'm doing wrong.

    Read the article

< Previous Page | 10 11 12 13 14 15 16 17 18 19 20 21  | Next Page >