• Biggest/Longest records in varchar table 2018-11-10

    We recently noticed that in one of our biggest tables some of the rows are a few times bigger than others. By "bigger" I mean longer and taking more storage space. How to display top 1000 biggest rows in the table? Almost all columns are varchar

    Tags: sql, sql server, varchar, maxlength
  • Stored Procedure runs over one dataset, but hangs over the other 2018-11-08

    I have a stored procedure which pulls a large SQL blob from a table. That SQL blob returns tens of thousands of records and then the SP performs certain actions on those records (inserts into different tables) . Essentially, the blob looks something

    Tags: sql, sql server 2008
  • MySQL Group By query produces indeterminate results 2018-11-07

    I have a problem ... I have one request, but each time I'm refresh the request, the result changes. Here is my request SELECT `t`.*, COUNT('ID') AS `tr` FROM ( SELECT * FROM HISTORY WHERE USER_ID = 1 AND BIEN_ID IS NOT NULL ORDER BY CREATED_AT DESC)

    Tags: mysql, sql
  • Error in my SQL syntax on SQL Fiddle 2018-10-31

    I'm new to sql programming. For a computer science project I am trying to apply my knowledge of sql in some way. On SQL Fiddle, I am using the MySQL 5.6 database and I am having so much trouble building schema. This is what it keeps telling me: "You

    Tags: mysql, sql, sqlfiddle
  • 1 Working Day Back In SQL DB2 2018-10-30

    I need to select data from database with a date that is one day back into the past but on working day. Is there a specific function for that ( Excel has got formula =Workday)? I am downloading data from DB2 to excel with VBA instructions. Here is the

    Tags: sql, db2, vba
  • Sql: How to combine multiple rows into a string as an expression within an update 2018-10-29

    In sql (MS sql server specifically) is it possible to combine multiple rows into a single string as an expression which is itself part of an update that is being applied to multiple rows. I have come across the approaches of using COALESCE or FOR XML

    Tags: sql, sql server
  • Getting 0 rows returned on query 2018-10-28

    so let me start will the basic table layout for all tables involved: #zip_code_time_zone +----+----------+-----------+ | id | zip_code | time_zone | +----+----------+-----------+ | 1 | 00544 | -1 | | 2 | 00601 | -3 | | 3 | 00602 | 0 | | 4 | 00603 | -

    Tags: sql, sql server
  • using sql like in java 2018-10-26

    I make a procedure that get a nvarchar and it return a table by using like and it works well. but when I want to use this procedure in java it doesn't work. here is the java code. String query = "exec Predict ?"; pst = conn.prepareStatement(quer

    Tags: sql, java
  • how to insert records from one table to another selecting only the common columns 2018-10-16

    i want to insert records from one table to another with common columns desc fp_mast null? type emp_id not null varchar2(4) emp_nm not null varchar2(35) typ not null varchar2(1) flag not null varchar2(1) st_dt not null DATE end_dt DATE wk_dt not null

    Tags: sql, oracle, select
  • Spark SQL: ORDER BY count DESC fails? 2018-10-15

    There is a table with two columns books and readers of these books, where books and readers are book and reader IDs, respectively. When trying to order readers by number of books they read, I get AbstractSparkSQLParser exception: import org.apache.sp

    Tags: sql, apache spark
  • SQL multiple queries response to variables 2018-10-13

    I want to make multiple queries in single connection I do this like FileName = "d:\database.mdb" strCnn = "Provider=Microsoft.Jet.OleDb.4.0;Data Source=" & FileName strSQL = "SELECT ID FROM [Users];SELECT DISTINCT ID FROM [Use

    Tags: sql, ms access, ole, ado
  • Hibernate query "or condition" won't work 2018-09-20

    I am trying the following hibernate query but it always gives me a wrong result: @SuppressWarnings("unchecked") @Override public List<Jcelulasmin> getAllOthers(int id, String username) { Session session = this.sessionFactory.getCurrentSess

    Tags: mysql, sql, java, hibernate, hql
  • how to convert .sql file to .xlsx(excel) without third party tools 2018-09-17

    i am using mysql server using mysqldump import command i have taken backup of my database in backup.sql file Now i want convert this file in MS excel2010 please suggest me easy way with out using any third party tools .Thank you --------------Solutio

    Tags: mysql, sql, excel, excel 2010
  • SQL max by 2 column, or first and last aggregate function 2018-09-16

    How to get max by colum1 1 then by colum 2 in sql? and is there aggregate function like first or last? I tried 2 ways: 1-it's get me max date but the max price is not associated with max date: SELECT doc_kits_t.DateOper, kits_t.DocId, kits_t.GoodId,M

    Tags: sql, sql server
  • Strange behaviour of two simple SQL Statement (Error) and one is crashing 2018-09-11

    I have a database table with 50.000 customer data records. When I run this query: SELECT * FROM customer --> The result is, that I get only 22.000 data records. When I run this query: SELECT * FROM customer WHERE customer_id < 50.001 --> The resu

    Tags: sql, sql server, select, sql server 2008 r2
  • Update Column based on Bulk insert from CSV SQL 2018-09-08

    I am trying to update a table based on the CSV file. I have got list of Id's and trim number in CSV and I need to update the Trim number based on the specific id's in the SQL table. So far the script I have written -- Create a temporary table for the

    Tags: sql, sql server, csv
  • Create trigger to update the table row 2018-08-28

    Hi there i would like to create a trigger for (It's MYSQL) what i had first, which doetn't work correct, keep getting project_id to 0 and hash value and insert the project_id_md5. CREATE TRIGGER project_auto_md5 BEFORE INSERT ON project FOR EACH ROW

    Tags: mysql, sql, triggers
  • PHP + Mysql Select and Count 2018-08-22

    I need get specific values and count all values from a MySQL table, i need get the best performance, my question is: What is better and faster? - Use two separate queries: $TBCount = $Resps = $MySQL->query('SELECT COUNT(*) FROM T1'); $Resps = $MySQL-

    Tags: php, mysql, sql
  • Convert SQL datetime to C# string 2018-08-18

    I'm trying to convert the ReturnDate to a string. As of now it's stored in the database as a Datetime and I wish to convert to a string in C#. [Display(Name = "Return Date")] public string ReturnDate { get { return this._ReturnDate; } set { this

    Tags: sql, datetime
  • Sql Query to get only non null values in a row in Sql Sever 2018-08-14

    How to get columns with only non null values. Say Output of CTE1 is ColA , ColB , ColC , ColD , ColE 1 , 2, NULL, NULL, NULL So in I must write a CTE2 that takes CTE1 (ColA to Col E) (ONLY ONE ROW ALWAYS) as Input and returns only Non null Values i.e

    Tags: sql, sql server 2008

Copyright (C) dskims.com, All Rights Reserved.

processed in 2.584 (s). 9 q(s)