sql

comparing dates in PHP and MYSQL

I am trying to figure out what is the best way to Grab the current date/time (is date('Y-m-d H:i:s') best?) Grab the db date from SQL Check if the current date (#1) is between the date pulled from the DB and 5hours after it I'm a newbie at php. ...

lastInsertId from a bulk insert?

Hy there, Bulk insert question on how to get lastInsertId. INSERT INTO details (idactivity,user,hours,val,date) VALUES ('981','133','0','10500','2008-07-01'),('981','184','0','2750','2008-07-01'),('981','184','0','2750','2008-07-01') (iddetails as details table PK) Is there a way to get the 3 new iddetails and get them to the next bu...

SSRS - Keep a table the same width when hiding columns dynamically?

Greetings. I have a SSRS 2005 report that shows prices of things. For some customers, I hide a column from the table (with an expression on the Visibility - hidden property). When I do this, my table shrinks. I've searched long and hard for a way to dynamically resize this table (or to do something at design time to make it stay the ...

What is faster, flat files or a MySQL RAM database?

I need a simple way for multiple running PHP scripts to share data. Should I create a MySQL DB with a RAM storage engine, and share data via that (can multiple scripts connect to the same DB simultaneously?) Or would flat files with one piece of data per line be better? ...

What happens to the transaction in this SQL if it's not committed?

If I have the following SQL: BEGIN TRANSACTION SELECT val FROM myTable and don't follow it up with a commit, what happens with the TRANSACTION? Does it depend upon the context/scope that it was executed (e.g. in a proc, in mgt studio)? Is there some place to see if there are transactions open that have not been committed/rolled back ...

What is the difference between setting statement fetch size in JDBC or firing a SQL query with LIMIT clause?

What is the difference between setting statement fetch size in JDBC or firing a SQL query with LIMIT clause? ...

ODBC SQL Server driver error

I have a VB6 app that access's a database thru a ODBC Connection. It will run fine for a few hours then I get the following Error. Any Ideas? [Microsoft][ODBC SQL Server Driver][DBNETLIB]ConnectionWrite(WrapperWrite()) ...

Which sql server data type best represents a double in C#?

Is it money, float, real, decimal, _____ ? ...

How to convert accdb to a postgres database

Hey, I need to use an .accdb database, and to do that it needs to be imported into PostgreSQL. I believe this would be a simple and straightforward problem (I expected it had been already solved), but a simple solution escapes me. I'll add that I don't have access to Access (lol), and my solution is loosely dependant on that. If th...

Grabbing most recent row based on column with repeating data?

Table [myRecords] A | B | C | D | E | F | ------------------------------------------------------------------------ 1 | 10 | 1/1/09 | abc | aaa | 111 | 2 | 10 | 1/2/09 | def | bbb | 222 | 3 | 10 | 1/...

SQL 2005 Standard Datatypes

I'm putting together a database of locations for looking up nearest locations for a given address. As I started laying out the table going about my business I wondered what other people were doing and if there was a 'best practices' for some common datatypes. Such as phone numbers, addresses and even latitude and longitude. This is wha...

Why does MySQL always return no data for this query?

I have a database in which a few fields are set as index. I don't know if this has to do with the problem or not, but when creating a query I get no results. Here is how I have things set in the database. The database has 90,000 records and this table is set like: | fieldA | fieldB | fieldC | fieldD | fieldA = index - CHAR fieldB = ...

MySQL: Union of a Left Join with a Right Join

Hi all, Say we have the following tables t1 and t2: t1: id | column_1 ------------- 1 | 1 2 | 2 t2: id | column_2 ------------- 2 | 2 3 | 3 and we want to find the following result: id | column_1 | column_2 ------------------------ 1 | 1 | 2 | 2 | 2 3 | | 3 This basically is the union of a r...

Select Records that match ALL groups in a many to many join table

Hi I have 2 tables: sets and groups. Both are joined using a 3rd table set_has_groups. I would like to get sets that have ALL groups that I specify One way of doing it would be SELECT column1, column2 FROM sets WHERE id IN(SELECT set_id FROM set_has_group WHERE group_id = 1) AND id IN(SELECT set_id FROM set_has_group WHERE group_id =...

MySQL Convert latin1 data to UTF8

I imported some data using LOAD DATA INFILE into a MySQL Database. The table itself and the columns are using the UTF8 character set, but the default character set of the database is latin 1. Because the default character type of the database is latin1, and I used LOAD DATA INFILE without specifying a character set, it interpreted the ...

(SQL Query, Email) Need a query to find "thread items" based on a field in the same table.

Hi All, I'm looking to perform a somewhat complex SQL Query and I'm having a bit of a time wrapping my head around what I need to do. I can't seem to figure out a JOIN that will work for my situation. Basically, my issue is that I have a table of EMAIL objects with various headers separated out and I'm trying to implement THREADING. ...

SQL Join Problem... what is it called?

Hi, I have two tables that are joined. I've included the 'output' of the joined tables. I'm wondering what is this join problem called? There are duplicating rows. Table 1          Table 2 ID     Name     ID Name 1     Joey         4 Mary 2     Shawn      5 Xavier 3     Mark         6 Gary The join output is: ...

OPENXML with xmlns:dt

Use OPENXML to get dt element in MSSQL 2005. How can I get xmlns:dt element in xml? For example, get a result set of two rows that list product id and country code. 121403 GBR 121403 USA declare @xmldata xml set @xmldata = '<?xml version="1.0"?> <data xmlns="http://www.aaa.com/master_browse_response" xmlns:dt="http://w...

MySQL: Avoid filesort when using IN and ORDER BY

Let's suppose I have the following table (let's call it my_table): CREATE TABLE `my_table` ( `table_id` int(10) unsigned NOT NULL auto_increment, `my_field` int(10) unsigned NOT NULL default '0' PRIMARY KEY (`table_id`), KEY `my_field` (`my_field`,`table_id`) ) ENGINE=MyISAM The primary key for my_table is table_id (auto_i...

SSRS 2005 Subscriptions

I am currently using SSRS 2005 subscriptions to send email on certain events. I have maxed out the allowed number of subscriptions though and it has brought the emails to a halt. Is there anyway for me to allow more subscriptions? ...