database

Can I combine my two SQLite SELECT statements into one?

Hi, I have a SQLite table called posts. An example is shown below. I would like to calculate the monthly income and expenses. accId date text amount balance ---------- ---------- ------------------------ ---------- ---------- 1 2008-03-25 Ex1 -64.9 37...

MS Access row number, specify an index

Hi, Is there a way in MS access to return a dataset between a specific index? So lets say my dataset is: rank | first_name | age 1 Max 23 2 Bob 40 3 Sid 25 4 Billy 18 5 Sally 19 But I only want to return those records between 'rank' 2 and 4, so my results set is Bob, ...

use database view in Django

I saw the former question can i use a database view as a model in django and try it in my app,but that's not work.I create a view named "vi_topics" manually and it had "id" column。But I always got the error about "no such column: vi_topics.id",even I add "id" field explicitly. here is my view models : from django.db import models cl...

database design for capturing trending keyword

Hi I need some help on creating database design for capturing and scoring trending keywords. What i have so far is: keyword_id int auto_increment keyword varchar description tinytext date_trend_started datetime mention_count int ranking int day_at_top datetime days_at_top int what else needs to be considered ...

Best way to add a new column with an initial (but not default) value?

I need to add a new column to a MS SQL 2005 database with an initial value. However, I do NOT want to automatically create a default constraint on this column. At the point in time that I add the column the default/initial value is correct, but this can change over time. So, future access to the table MUST specify a value instead of a...

How to do a NVL (or DECODE or CASE) statement within an Informix SE SQL query ?

Hi, IBM is very clear on his Informix Standard Engine, it doesn't support neither CASE nor DECODE. "Please upgrade to a new version" : http://www-01.ibm.com/support/docview.wss?rs=632&context=SSGU5Y&dc=DB560&dc=DB520&uid=swg21189712&loc=en_US&cs=UTF-8&lang=en&rss=ct632db2 It will never happen ! So maybe...

How can I delete a row from a database with C#?

How can I delete a row from a database with C#? First I show the table content in a GridView, and I want to know how to delete the row I selected in the GridView (when I press the delete button) from the database. ...

Best practices for getting around DB differences with an IDataReader

I have a simple value object which I populate with data from an IDataReader (could be the result of a query to either an Oracle or MS SQL database). The factory method for this object looks something like the following: internal static SomeClass CreateFromDataReader(IDataReader data) { string message = data.GetString(0); short i...

Why is an insert of 1M records slower without a transaction than inside a transaction?

I am doing some performance tests using .Net 3.5 against SQL Server. I am doing an insert of 1 million records. When I wrap this inside a transaction (either serializable, RepeatabelRead or ReadUncommited) it runs in under 80 seconds on my system. When I remove the transaction it runs in roughly 300 seconds. I would expect that using no ...

Best way to save only day and month in database

We have to save the day and the month of a yearly reoccurring event. (Think of it as the day of they year when the invoice has to be sent to the client.) We will have to do some computation with this information. E.g if the customer is paying twice per year. Then we do not only have to check if this day is today but also if this day is ...

How to created a "singleton" scheduled job in oracle?

It's probably just the vocabulary I am missing to find out how to do this: A job scheduled to run regularly every 5 mins, however keeping track that there are never two instances of it running at the same time, i.e. the next instance would be postponed or skipped if the prior runs longs than 5 mins. What is the easiest/most elegant way...

How to add data to two tables linked via a foreign key?

If I were to have 2 tables, call them TableA and TableB. TableB contains a foreign key which refers to TableA. I now need to add data to both TableA and TableB for a given scenario. To do this I first have to insert data in TableA then find and retrieve TableA's last inserted primary key and use it as the foreign key value in TableB. I t...

Determine which user deleted a SQL Server database?

Hi, I have a SQL Server 2005 database that has been deleted, and I need to discover who deleted it. Is there a way of obtaining this user name? Thanks, MagicAndi. ...

install sqlite3 on mac os x?

I am trying update my version of sqlite3 on mac os x 10.5.7 I downloaded the source code that is recommended for unix and unix like programs. I followed the compile and install directions in the readme file and everything seems to work fine. However, when i check the version number of sqlite3 it remains at 3.4.0 (the old version). Wh...

Oracle Generic DB Link not working

I'm trying to use oracle's hsodbc generic database link driver to access a postgresql database from my oracle 10gr2 database server. I think I have everything configured but I'm receiving this error from the sqlplus promt after trying a remote query. SQL> select * from temp_user@intranet; select * from temp_user@intranet ...

Access 2007, Textbox search box like the Facebook name search box on the top right

Hi, so basically I have an AddCompany Form, where theres a textbox [CompanyName], i want to type a new company name in there, but meanwhile check if theres an already existing one. So for example,say i want to type Microsoft, when i type M, the textbox shows whole bunch of other names with M, and then keeps going until I type finish ty...

Usefulness of separating database files and trans logs among partitions

Some guys where I work are setting up a new database server for SQL Server. The server has a system drive that also stores backups and a single RAID 5 array for the database files. The RAID 5 array is logically partitioned into 2 drives. One is for the actual database files (MDF) and the other is for the transaction logs (LDF). The quote...

Dynamic Linq To Sql With ComboBox and Column.Contains

I have a text box, combo box, button and DataGridView on a form that is used to search and return customer information from a MSSQL view (vCustomer). It works great, but I know my code can be more efficient. The four items in the combobox represent columns to search. Is there a simple way of converting the following to dynamic LINQ to...

Run a query from two data sets programmatically

I am trying to reconcile data from a website and a database programmatically. Right now my process is manual. I download data from the website, download data from my database, and reconcile using an Excel vlookup. Within Excel, I am only reconciling 1 date for many items. I'd like to programmatically reconcile the data for multiple date...

How can I import load a .sql or .csv file into sqlite?

I need to dump a .sql or .csv file into sqlite (I'm using sqlite3 API). I've only found documentation for importing/loading tables, not entire databases. Right now, when I type sqlite3prompt> .import FILENAME TABLE I get a syntax error, since it's expecting a table and not an entire DB. ...