database

PostgreSQL character varying length limit

I am using character varying data type in PostgreSQL. I was not able to find this information in PostgreSQL manual. What is max limit of characters in character varying data type? ...

Hibernate Auto-Increment not working

I have a column in my DB that is set with Identity(1,1) and I can't get hibernate annotations to work for it. I get errors when I try to create a new record. In my entity I have the following. @Entity @Table(schema="dbo", name="MemberSelectedOptions") public class MemberSelectedOption extends BampiEntity implements Serializable { ...

Creating SQL table using Dynamic variable name

I want to create backup SQL tables using variable names. something along the lines of DECLARE @SQLTable Varchar(20) SET @SQLTable = 'SomeTableName' + ' ' + '20100526' SELECT * INTO quotename(@SQLTable) FROM SomeTableName but i'm getting Incorrect syntax near '@SQLTable'. It's just part of a small script for maintence so i ...

Database scheme for strong SNMP data

Hi, I am trying to build a MYSQL DB for storing SNMP MIB information (a small subset of OIDs only).. Is there a DB schema that I may refer to? Thanks, Neel ...

.TBL database extension

Is there any database out there that uses the .TBL or .tbl file extension? For example, MySQL uses .frm for some engine types. I have a file that presumably came out of some database with this file extension. Unfortunately, most searches lead to useless spam sites or the Unix command troff. Is there someone out there that has ever wo...

What is the most "database independent" way of creating a variable length text field in a database

I want to create a text field in the database, with no specific size (it will store text of length unknown in some case) - the particular text are serialized simple object (~ JSON) What is the most database independent way to do this : - a varchar with no size specified (don't think all db support this) - a 'text' field, this seems to b...

backup SQL Server 2008 database on a network drive

Hi, I need to backup my SQL Server 2008 database to another PC on network. I've even mapped network drive and assigned it another driver letter. But when I try to select .bak file while exporting, only C: shows up. I've even restarted my SSMS. Can somebody point out what else I may need to do? Thanks! ...

MySQL DELETE in a single table

Hi, I have a database with only one table as below: userurltag(id,userID(string),Url(String),tag(String)) I want to delete users that have less than 3 urls associated with them. How can I do that? ...

Thoughts/Input about Database Design for a CMS

I'm just about to expand the functionality of our own CMS but was thinking of restructuring the database to make it simpler to add/edit data types and values. Currently, the CMS is quite flat - the CMS requires a field in the database for every type of stored value (manually created). The first option that comes to mind is simply a tab...

Best way to encrypt certain fields in SQL Server 2008?

I'm writing a .NET web app that will read and write information to a SQL Server 2008 database. Some of this information will be highly confidential in nature so I want to encrypt certain data elements. I don't want to use TDE or any full-database encryption for performance reasons. My main concern is protecting this sensitive data as a...

Best pattern for storing (product) attributes in SQL Server

We are starting a new project where we need to store product and many product attributes in a database. The technology stack is MS SQL 2008 and Entity Framework 4.0 / LINQ for data access. The products (and Products Table) are pretty straightforward (a SKU, manufacturer, price, etc..). However there are also many attributes to store w...

Problem with mysql query to replace a string

I've used mysql's update replace function before, but even though I think I'm following the same syntax, I can't get this to work. Here's what I'm trying to do: UPDATE contained_widgets SET preference_values = REPLACE(preference_values, '<li><a_href="/enewsletter"><span class="not-tc">eNewsletter</span></a></li>', '<li><a_href="/en...

Three-way full outer join in SQLite

I have three tables with a common key field, and I need to join them on this key. Given SQLite doesn't have full outer or right joins, I've used the full outer join without right join technique on Wikipedia with much success. But I'm curious, how would one use this technique to join three tables by a common key? What are the efficiency ...

best way to store 1:1 user relationships in relational database

What is the best way to store user relationships, e.g. friendships, that must be bidirectional (you're my friend, thus I'm your friend) in a rel. database, e.g. MYSql? I can think of two ways: Everytime a user friends another user, I'd add two rows to a database, row A consisting of the user id of the innitiating user followed by the...

The Date type and the Android database

I understand that SQLite stores dates as long integers. When I read rows using the standard method (i.e. using the query() method that reads data into a cursor), the result is a date string that includes the time: 2010-05-25 19:52:04 If I want a different format, I have to parse the string back into a date - possible, but a bit backwa...

Exceptions in ASP.MVC

Hello guys, I'm here again with another question about MVC. Here is the deal. I have a simple table/class with an Id and a Name. Names suppossed to be unique, and are modeled like that in the DB. I created my controller and everything just works fine. But if I try to insert a name that already exists, an exception should be thrown. I'm...

Best way to access database from android

I am working on a Android app and I have a dilemma. I have a list of Objects. I have to update each of these objects with a database. I have 2 methods: Method 1: I can loop through the Objects. For each object I can connect to the server, update it, and then move on to the next Object, and so forth. Method 2: I can store th...

friendship database schema

I'm creating a db schema that involves users that can be friends, and I was wondering what the best way to model the ability for these friends to have friendships. Should it be its own table that simply has two columns that each represent a user? Thanks! ...

Prroblem with ObjectDelete() in Entity Framework 4

I got two entities: public class User : Entity { public virtual string Username { get; set; } public virtual string Email { get; set; } public virtual string PasswordHash { get; set; } public virtual List<Photo> Photos { get; set; } } and public class Photo : Entity { public virtual string FileName { get; set; } ...

Unstructured database design

Hi all, According to normal way, we design the table with fields. Example with an article the table can contain fields as follows: title, content, author..... But how does everybody think if we add up some fields to a field? ...