sql

Change SQL decimal delimiter

Hello! I am trying to import data into my table using INPUT INTO The problem is my decimals is using , as a delimiter, and it expects .. So it won't work! How can i change this? Search and replace in the input file is not an option! I am using SQL Anywhere 10 ...

Informix: The meaning of dot (.)?

Hey guys, I am wondering if anyone could tell me any special meaning of the dot (.) in Informix regarding expressions and etc. For example in stored procedures I see it used with integers, decimals and chars and one thing that is bugging me quite a lot is this: if value = '.' then //do something end if The above expression validate...

MySQL++, storing realtime data

Hi, Firstly I'm an engineer, not a computer scientist, so please be gentle. I currently have a C++ program which uses MySQL++. The program also incorporates the NI Visa runtime. One of the interrupt handlers receives data (1 byte) from a USB device about 200 times a second. I would like to store this data with a time stamp on each sample...

PostgreSQL: change date by the random number of days

How can I change the date by the random number of days in PostgreSQL? Unfortunately http://stackoverflow.com/questions/1400505/postgresql-random-number-range-1-10 solution with trunc doesn't work: select date(now()) + (trunc(random() * 20)) results in: ERROR: operator does not exist: date + double precision LÍNEA 1: select date...

meaning of %%% in sql query?

I am familiar with this kind of query: select * from tableA where foo like '%bar%' But today I run into three adjacent percentage signs in some legacy code, like this: select * from tableA where foo like '%%%' This query seems to work, both on mssql and oracle, when foo is of string type (varchar, etc.) but it fails when foo is num...

Bad performance of SQL query due to ORDER BY clause

Hi, I have a query joining 4 tables with a lot of conditions in the WHERE clause. The query also includes ORDER BY clause on a numeric column. It takes 6 seconds to return which is too long and I need to speed it up. Surprisingly I found that if I remove the ORDER BY clause it takes 2 seconds. Why the order by makes so massive difference...

MS Access 2003 - Having trouble with buttons not working in mde file: list box .rowsource

So I have a form that has a list box and several buttons that run sqk statements for the list box. sub on_onClick() ' error checking me.listbox.rowsource = "SELECT tblMain.First, tblMain.last FROM tblMain ORDER BY tblMain.Last;" so this kinda thing is what I use for the list box. it works fine for me in the .mdb, and after i have co...

another way instead trigger

hi how do I get the type of automatic actions (similar to the once done by triggers) using stored procedures instead, or any other way to this, because i need when i (insert or update or delete) a record in tableA ,or tableB i need to do the same operation in table C, i don't want to use the trigger because some Disadvantages such as :...

SQL: Search a list of columns with a given value (within a row)

I have a table with many columns. Is there a way to make a query that answers the question: "For a particular _id (the primary key), what field(s) in this row have a value of 10"? EDIT: Clarification: The table is set up properly. The querying I am doing is some manual querying as I track down some incorrect data. The table has be...

HowTo: BeginProcessRequest

Writing a Service that is running on IIS. Basically looks like this: void ProcessRequest(HttpContext context) { <Init Stuff> <Access DB> // This may potentially stall for DB access <Write Output to conext stream> } By stalling the thread in the <Access DB> section we are basically blocking one of the IIS service thre...

How to Optimize this SQL Query?

I have 3 tables: CRSTasks (ID,parentID) CRSTaskReceivers (ID,tskID,receiverID) UserNames (id,name) ...relation between CRSTasks and CRSTaskReceivers one-to-many between UserNames and CRSTaskReceivers one-to-one tasks ID parent 1 null 10 1 50 1 taskReceivers id taskID receiverID 1 1 ...

SQL "transform" query

I have these data on a table (using SQL Server 2005): ID ParentID StartTime EndTime 77 62 08:00:00 11:00:00 78 62 12:00:00 15:00:00 79 62 18:00:00 22:00:00 and I want to transform it into this: ParentID BreakfastStart BreakfastEnd LunchStart LunchEnd DinnerStart DinnerEnd...

How to figure out how many tables are affected in database after inserting a record?

One third party app is storing data in a huge database (SQL Server 2000/2005). This database has more than 80 tables. How would I come to know that how many tables are affected when application stores a new record in database? Is there something available I can retrieve the list of tables affected? ...

How can I test that a SQL "CREATE TABLE" statement is equivalent to an existing table?

For each table in my MySQL database I have a mytablename.sql file which contains the CREATE TABLE statement for that table. I want to add a test to check that noone has added/altered a column in the live database without updating this file - that it, I want to check that I can re-create an empty database using these scripts. How can I ...

Loading data from one table into two other tables (one detail, one summary) that are related

Suppose that I have a source table like this: Source SourceKey (PK) Data1 Data2 Amount And I am loading data from 'Source' into two related tables that look like this: Summary SummaryKey (PK) Data1 Data2 Amount Detail DetailKey (PK) SummaryKey (FK) SourceKey (FK) Data2 Amount EDI...

Display all the stored procedures in a database

Is there any way to display all of the stored procedures in a database? ...

NHibernate: lazy loaded properties ?

NHibernate question: Say I have a SQL table Person and it has a Picture column ( OLE Object ) . I have a class Person and it has : byte[] Picture attribute. Is it possible to map like this ? <property name = "Picture" column = "Picture" type = "System.Byte[]" lazy="true" /> Does the "lazy" keyword have any effect on properties ...

LINQ to SQL defining Where class depending on parameters

return (from s in db.StudentMarks where s.Class == Class && s.Year == Year // this line orderby s.Year, s.ExamType select new StudentAddMarks() { --Obj }).ToList(); I am going to return an Object depending on the Class and Year params. ...

Unique Keys not recognized by Entity Framework

I have two tables, Reports and Visualizations. Reports has a field, VisualizationID, which points to Visualization's field of the same name via a foreign key. It also has a unique key declared on the field. VisualizationID is not nullable. This means the relationship has to be 0..1 to 1, because every Reports record must have a unique, n...

Should I index or store these fields in Solr (or any db) ?

Background: I have a cclassifieds website, and users may for example search for cars, and specify a price range, mileage, fueltype, gearbox and a manually inputted query-string if they like to put something specific into the search, ex "bmw m3". Questions: I am about to move this information to Solr for faster lookup, and wonder if I ...