I'm working on a project and I want to store some easily enumerated information in a table. MySql's enum data type does exactly what I want: http://dev.mysql.com/doc/refman/5.0/en/enum.html . Is there an equivalent in SQL Server 2005?
I know I could store the possible values in a type table with a key, but I'd rather not have to link ...
In MySql's interpreter, it's very easy to dump a table to the screen along with its field names.
There seems to be no simple way to export a table to a tab-delimted or CSV outfile including its column headers.
I'm trying to do this using only SQL or the Linux command line, without writing a program in another language.
Thank you
...
Given a result set, how can I determin the actual names of the fields specified in the query (NOT their aliases).
$query = "SELECT first AS First_Name, last AS Last_Name FROM people";
$dbResult = mysql_query($query);
$fieldCount = mysql_num_fields($dbResult);
for ($i=0; $i<$fieldCount; $i++) {
// Set some values
$fieldName ...
I'm wondering how slow it's going to be switching between 2 databases on every call of every page of a site. The site has many different databases for different clients, along with a "global" database that is used for some general settings. I'm wondering if there would be much time added for the execution of each script if it has to conn...
Alright. I have a query that looks like this:
SELECT
SUM(`order_items`.`quantity`) as `count`,
`menu_items`.`name`
FROM
`orders`,
`menu_items`,
`order_items`
WHERE
`orders`.`id` = `order_items`.`order_id` AND
`menu_items`.`id` = `order_items`.`menu_item_id` AND
`orders`.`date` >= '2008-11-01' AND
...
I have this current problem with data i have to represent in a MySQL database:
I have to support different kinds of products with different data each one, for example, cars, hotel rooms, books, etc. For my application there is some data which is common for each product, like name, description, price, etc.
So I think of having a produc...
I am using the MYSQL C API and I have a MYSQL_ROW object that I would like to convert to a string. Does anyone know how to do this? I haven't found anything in the API's doc yet.
string str = (string)row[0] <-- runtime error
P.S. I tried casting it to a string but it doesn't work
...
I'm doing some searching of tags, and some users like "cat" while others like "Cat" Go figure...
Anyways, is there a way to force a particular find to be case sensitive? Such as:
Tag.find(:some-special-option-here)
Any ideas?
...
After much googling I have been wondering what the benefits/differences are between mysql and sqlite3. I am primarily hoping for a speed bump when moving my development database to my production database, although I imagine this will primarily happen in my code. Does any know what the major differences are in performance? ARE there? Or w...
How do you stop race conditions in MySQL? the problem at hand is caused by a simple algorithm:
select a row from table
if it doesn't exist, insert it
and then either you get a duplicate row, or if you prevent it via unique/primary keys, an error.
Now normally I'd think transactions help here, but because the row doesn't exist, the t...
Hello,
I am trying to import an access database to mysql. I have created a mysql database, but do not want to use all of the colums in the access database. Is there a way to export only certain colums from the access database to csv?
...
OK, I have just been reading and trying for the last hour to import a csv file from access into mysql, but I can not get it to do it correctly, no matter what I try.
My table is like so:
+-----------------+-------------
| Field | Type
+-----------------+-------------
| ARTICLE_NO | varchar(20)
| ARTICLE_NAME | varchar...
First some background. I am trying to run Community Engine on a fresh install of Ubuntu. CE is a open src social networking plugin running on Rails. I was able to get CE up and running on my windows box w/o issue. I have decided to use Ubuntu 8.10 as my development environment now, and am stuck on this issue. I have researched this for t...
I'm running Leopard and wanted to know what the easy way to setup a web development environment to use Python, MySQL, Apache on my machine which would allow me to develop on my Mac and then easily move it to a host in the future.
EDIT: I've been trying to get mod_wsgi installed and configured to work with Django and have a headache now....
I used to use the standard mysql_connect(), mysql_query(), etc statements for doing MySQL stuff from PHP. Lately I've been switching over to using the wonderful MDB2 class. Along with it, I'm using prepared statements, so I don't have to worry about escaping my input and SQL injection attacks.
However, there's one problem I'm running in...
Using CodeIgniter with persistent connections disabled.
...
I have a table that saves some account limits like users. For most rows this value will be an integer. However I will also need to support storing unlimited (infinite) as a value. This might seem silly but is there a common integer value that represents unlimited (infinite)? I'd like to keep storing the values as integers.
...
I have the following table schema;
CREATE TABLE `db1`.`sms_queue` (
`Id` INTEGER UNSIGNED NOT NULL AUTO_INCREMENT,
`Message` VARCHAR(160) NOT NULL DEFAULT 'Unknown Message Error',
`CurrentState` VARCHAR(10) NOT NULL DEFAULT 'None',
`Phone` VARCHAR(14) DEFAULT NULL,
`Created` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
`Las...
I need to do a date comparison in Mysql without taking into account the time component i.e. i need to convert '2008-11-05 14:30:00' to '2008-11-05'
Currently i am doing this:
SELECT from_days(to_days(my_date))
Is there a proper way of doing this?
...
(Note: This is for MySQL's SQL, not SQL Server.)
I have a database column with values like "abc def GHI JKL". I want to write a WHERE clause that includes a case-insensitive test for any word that begins with a specific letter. For example, that example would test true for the letters a,c,g,j because there's a 'word' beginning with each...