sql

SQLITE INNERJOIN Nightmare, need a solution to this.

Dear fellow members, It's nice to find such a useful site with genius members. I have been trying to find a solution for this SQLITE problem for a while now. Google didn't help me, except in finding this website. The SQL query works fine on the MSAccess version of the same database. Here's my SQL statement - which didn't work for me. ...

Newb SQL question: Is there a "foreign key" equivalent for referencing columns, or is it logical to store column names as strings in another table?

Disclaimer: I'm an SQL newb, just discovering the great possibilities of sqlite embedded in applications. I'm designing a small database for an application that primarily handles data storage for plotting. Say I have several instrument data tables (one for each type of instrument) with a column for each data field, such as pressure, ...

Design question: Filterable attributes, SQL

I have two tables in my database, Operation and Equipment. An operation requires zero or more attributes. However, there's some logic in how the attributes are attributed: Operation Foo requires equipment A and B Operation Bar requires no equipment Operation Baz requires equipment B and either C or D Operation Quux requires equipment (...

Why isn't this easy join working? (mysql)

I have two tables, classified and fordon. classified table: classified_id (PK) etc... fordon table: id (PK) classified_id (FK) I try to use this code: SELECT * FROM classified, fordon WHERE classified.ad_id IN ('$solr_id_arr_imploded') AND classified.classified_id=fordon.classified_id BTW, the array is a set of ad_id:s returned fr...

Copying template data from a table in nhibernate

I have a bunch of data that is stored in a few tables and serves as a template when a new customer or such is created. I know i could do a select and copy all the properties and execute a save, however some of the fields are large retrieving to and from the db doesn't seem the most optimal idea. I have also thought about writing a cus...

How to select columns from a table which have non null values ?

I have a table containing hundreds of columns many of which are null, and I would like have my select statement so that only those columns containing a value are returned. It would help me analyze data better. Something like: Select (non null columns) from tablename; I want to select all columns which are not-nullable for all rows. Ca...

SQL Server 2000 equivalent for ON DUPLICATE KEY?

Is there a SQL Server 2000 functional equivalent to MySQL's ON DUPLICAT KEY clause? This Answer led me to look at the Instead of Trigger construct, but the sample looks clunky, and the functionality would be hidden in the trigger, and not be directly in the stored proc. FWIW: I am trying to create a stats table for per-minute summaries,...

Problem in Retrieving records by giving from and to date

Hi all, I have a Problem in Retrieving records by giving from and to date. I want to fetch record for date Feb 08 2010, and I should use To and From date fields. I tried: select * from dbo.BuzzMaster where date >= '2/7/2010' and date <= '2/8/2010' Output: Not able to retrieve records for date '2/8/2010' I get the record for d...

Numeric Columns In SQLDMO BulkCopy

I have a table with numeric columns. When I'm using SQLDMO bulkcopy to insert data , its failing. Please help. ...

Firebird SQL: Check if notNULL constraint is set for a specific column?

I want my C# program to know if the notNULL constraint is set for a specific Firebird database column. Can it be checked dynamically, perhaps by querying the meta data? I find the Firebird documentation to be very sparse. Also, how does Firebird provide information what columns exist in a specific table? ...

sql query adding column values

Hi friends, I want to add two columns values of my table and sort it in descending order. E.g: int_id int_test_one int_test_2 1 25 13 2 12 45 3 25 15 Considering the table above, I want a SQL query which give me the result like below: int_id sum(int_test_o...

Wrong week number using DATEPART in SQL Server

I've got the problem that select datepart(ww, '20100208') is returning as result week 7 in SQL Server 2000. But 08.02.2010 should be week 6 according to the ISO 8601 specification! This is causing problems in delivery week calculations. What should I do to get week number values according to ISO 8601? ...

Get all field names in Microsoft Access Table using SQL

Hello all, How do I get all the field names in a Table in Microsoft Access using JET SQL? Thanks all ...

MySql query cache settings

How can I set the query cache of MySql? My "my.ini" file doesn't contain the variable mysql_query_type or mysql_query_size at all... How are these set? Can they be set from PHP? Thanks ...

Zend_Db_Table_Abstract and MySQL COMMENTs

I have built a query tool that enables a non-technical user to query parts of a database. I want to rename all the columns nicely. e.g.: table_id` > "Table ID" forename > "Forename" phone > "Telephone" I have put all the information into the MySQL COMMENT field as in: ALTER TABLE `table` CHANGE `field` `field` INT( 11 ) NOT NULL COM...

Performance for delete query in sql

I have a table with 200,000 records. I want delete some data like below : DELETE FROM Table Where IdColumn IN ( SelectedID ) SelectedID fill with my desirable data identities that contains 5000 records. there are 2 approach: 1- I insert 20,000 identity as SelectedID that contains identities of desired 5000 records. 2- I insert only ...

when adding a column more to a DB table, how do you get your datagridview to show the change?

I have created a dataset in a project in visual studio that points to a table in my database and then bound a datagridview control to it. Now I open the database and add another column to the table in the database. Then i open the dataset and update it's configuration to include the change. Then i want to update the datagridview, but I...

how to fetch the row count for all the tables in a SQL SERVER database

I was in search of a SQL Script , in order to determine , if there is any data(row count ideally) in any of the tables in a given database. The idea was to re incarnate the database , in case if there are any rows existing(in any of the database) . The database being spoken of is SQLSERVER. Could Someone suggest a sample script.? th...

HAVING ANY and HAVING EVERY in SQL Server 2005

Hi, Does SQL Server 2005 support ANY or EVERY with HAVING? Suppose I have two tables Training(TrainingID, TrainingCloseDate) and TrainingDetail(TrainingDetailID,TrainingID,LKClassCode,CompletionDate). For one TrainingID, there can be multiple values in TrainingDetail with different LKClassCode. I need to find all the TrainingIDs which...

SSIS - SharePoint to SQL without Adapter Addin?

Hey all, Im looking to Extract a SharePoint List (WSS 2.0) to a SQL(2005) Table using SQL Server Integrated Services. First off I am aware of the "adapter" that does this from http://msdn.microsoft.com/en-us/library/dd365137.aspx however I'm just wondering for compatibility purposes if it can't just be done "out of the box". There are...