How do I set a null value for an optional DateTime parameter in a constructor?
I'm using the following constructor below and I want the optional parameter admissionDate to be a null DateTime. Setting it to Nothing actually gives it a value (something like #12:00:00 #).
Public Sub New(ByVal obj1 as Object, Optional ByVal admissionDate ...
I am using django for running my project. And I am using postgresql_psycopg2 engine for my production db, but the test runner uses sqllite3 for running the tests. Keeping my production db(postgresql)in mind I tried building a query which uses "coalesce". But sqllite3 doesn't recognize this. How do I get pass this. I can use postgresql_ps...
Hello,
I have a script that sends out emails every minute. When it starts its loop, it queries the database for all entries that are equal to the current utc time. I would like to have it find all entries in the database that correspond to the current time down to the minute.
So there is a 'time' column that stores the utc time: '2009-...
I'm writing a DB2 user-defined function for which I need an array of non-negative integers, which I represent as a varchar for bit data. I plan to use two bytes for each integer (giving me a maximum value of 2^16-1, which is acceptable).
I can convert an integer to a char for bit data by using the chr function, but how do I get it back ...
I have a tables called pages, page_views, page_items and page_votes. The latter three tables contain a page_id foreign key in order to keep a record of each individual view, item and vote that belongs to a page.
When I query a page, I also want to retrieve COUNT page_views, COUNT page_items and SUM page_votes.vote.
I have pasted a quer...
Say I have two tables, users and groups each of which has an auto-incrementing primary key. Whenever a new user is created, I would like to create a group along with that user (at the same time/same transaction). However, the users need to know which group they belong to thus each user stores a group_id.
In order to do this, I create ...
I'm writing a very simple blog engine for own use (since every blog engine I encountered is too complex). I want to be able to uniquely identify each post by its URL which is something like /2009/03/05/my-blog-post-slug. To accomplish it in the data tier, I want to create a compound unique constraint on (Date, Slug) where Date is only th...
When I have created a table with an auto-incrementing primary key, is there a way to obtain what the primary key would be (that is, do something like reserve the primary key) without actually committing?
I would like to place two operations inside a transaction however one of the operations will depend on what primary key was assigned i...
I'm not even sure this is possible to do efficiently, but here's my problem:
I'm writing what's essentially a blog engine where a blog post and all replies to each blog post can tagged.
So, I could have a blog post tagged "stack", and a reply to that post tagged "overflow".
Right now, I'm trying to generate a list of the most popular ...
I have an inheritance relationship in my database, where I have a parent table (Table A) that is basically a sequence of auto-incrementing integers (Id column). From here, I have several tables (Table B,C & D) that also have an Id column, which is a foreign key to the Id column in Table A.
Now my question is, if I have the Id, what is ...
What is the best way to get the auto-id value in the same SQL with a SELECT?
A forum said adding this "; has Return Scope_Identity()"
in the end of the SQL works in ASP.
Is there a corresponding way in PHP?
...
I use SQL Server 2005, MySql, and Posgresql regularly. I'm tired of using Microsoft's SQL tool for SQL Server, phpMyAdmin for MySql, and pgAdmin for Postgres.
Is there a decent cross-platform GUI that I can use for all of these database servers? I don't care about the actual database administration part, I realize that each vendor's to...
Had this question in an interview.
...
My data fits a tree form naturally. Therefore, I have a simple SQL table to store the data: {id, parentid, data1, ..., dataN}
I want to be able to "zoom in" on the data and produce a report which summarizes the data found below the current branch.
That is, when standing in the root, I want to have the totals of all the data. When I ha...
What is the recommended way to return ad hoc (custom case by case) data from repository which don't fit any model entities or which extend some?
The 101 example would be the ubiquitous hello word application: a blog system. Suppose you want to load a list of posts where post entry has some additional information which does not exists in...
We are building an application that may need to be replicated to many servers (I'm hoping not, but there's no way to know if clients will need their own client/server copy until after we release the online product).
Since the number of servers is unknown, I've decided to use GUIDs for any transactional table IDs. Since each client ha...
Some of our clients want to do their own reports and lack the necessary knowledge.
What are good free resources for learning basic T-SQL? What resources do you recommend to your clients and others wanting to start with SQL?
Update:
I totally agree with Cruachan, it's better not to do it. We usually don't go down that road and know ve...
Table has about 8 million rows. There is a non-unique index for X.
Showing indexes, it shows that in the table there is a non-unique index on key name X with "seq_in_index" of 1, collation A, cardinality 7850780, sub_part NULL, packed NULL, index_type BTREE.
Still, this query can take 5 seconds to run. The list of ints comes from anoth...
We need to generate dynamic SQL in our Java app. Does anyone know a simple library to do this?
In our Java app we have a bunch of where clause filter criteria (database column, operand, value). In other words, we could have a Date instance that we need to use to filter a given datetime Oracle column, a String instance that we need to...
I have a website where users can comment on photos. I have a table of comments in this format:
+----------+-------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+----------+-------------+------+-----+---------+-------+
| username | varchar(12) | NO | | NULL | |
| id ...