database

SQL DataType - How to store a year?

I need to insert a year(eg:1988 ,1990 etc) in a database. When I used Date or Datetime data type, it is showing errors. Which datatype should I use. ...

How to insert dynamically through a variable in PL/SQL??

Lets create a table first create table test ( id number, name varchar2(20) ); Now during insert, i wanna hold the data into variable first & then dynamically pass the variable into the VALUES clause. declare v_data varchar2(50); begin v_data:='1,sunny'; execute immediate 'insert into test values(v_data)'; commit; end; But ...

Obscure Relational Database Mapping to C# Dataset

Hi, apologies for the previous post, sometime writing the questions actually solves it too ;) as in "the answer is in the question" So I'm trying to interface an old primitive database system that is accessed vi a DLL entry point, however some work has been done on object rational mapping where one can create objects of each table and a...

Representing Key/Value Pairs Where the Value Can Be of Any Type (in a Relational Database)

A small but important corner of a database that I'm designing will be used to store the result of arbitrary calculations. These results can be of any type. How can I represent a Value field that can be of any type in a relational database? The only thing I can think of is to have separate tables based on data type that all have foreign ...

How to avoid a database race condition when manually incrementing PK of new row.

Hi! I have a legacy data table in SQL Server 2005 that has a PK with no identity/autoincrement and no power to implement one. As a result, I am forced to create new records in ASP.NET manually via the ole "SELECT MAX(id) + 1 FROM table"-before-insert technique. Obviously this creates a race condition on the ID in the event of simulta...

Oracle Datasource returning null connection

The oracle data source is returning null connection when the no of connection request is more. I have the implict cache enabled.The oracle specs says null is returned only is ConnectionWaitTimeout is set. I do not have a value set for ConnectionWaitTimeout in the cache properties. This is what the spec says about ConnectionWaitTimeout...

How to map many tables with same schema to one class

Is there a way in entity framework or linq to sql classes to map one class to many different tables with the same schema. For example if I have a database with thousands of tables for different stocks. All of the tables have the same columns. Is there a way I could have a base type class that could be used for mapping the data to an o...

Computing hashes for strings in SQL Server database - worth the effort?

Say I have a million-row table [mytable] in my SQL Server 2005 database, which has columns: ID SomeField AnotherField Url A very common query in this system is: select * from [mytable] where url = 'http://www.somesite.com/some/really/long/url' Which will give me better performance: a) Add an index to the Url column. or b) Add an...

insert records in database from an xml

Am writing a .net windows service using which i need to parse an xml (having about 5000 nodes). I need to parse these nodes and insert data (ie. 5000 rows)into a sql database. Shall I insert all these records with batch insert or shall i insert them one by one? can someone help me with the design/algorithm for optimum performance? ...

Running SQL Server 2005 in Windows Safe Mode

My computer has recently crashed and I can only run it in Safe Mode. I need to back up a SQL server 2005 database and transfer it a computer that works. Is there anyway to run SQL server 2005 in Windows Vista Safe Mode? ...

Command line tool for creating script for specific MSSQL tables

I've been looking at the SqlPubWiz.exe command to write a batch file so that I can keep my script up to date in my source control. But what I need is for the command line tool to allow me to pick specific tables to include (and that I can exclude others). I think SqlPubWiz.exe won't do that for me (let me know if I'm wrong) but if someon...

LINQ to SQL Left Outer Join

Hi, Is this query equivalent to a LEFT OUTER join? //assuming that I have a parameter named 'invoiceId' of type int from c in SupportCases let invoice = c.Invoices.FirstOrDefault(i=> i.Id == invoiceId) where (invoiceId == 0 || invoice != null) select new { Id = c.Id , InvoiceId = invoice == null ? 0 : invoice.Id } ...

Are there any local DB that support multi-threading?

I tried sqlite, by using multi-thread, only one thread can update db at the same time.. I need multi-thread updating the db at same time. Is there are any DB can do the job? ps: I use delphi6. I found that sqlite can support multi-threading, But in my test of asgsqlite, when one thread inserting, others will fail to insert. I'm ...

Database Replication MSSQL 2000 to 2005

I am trying to replicate a database from SQL server 2000 to 2005 they are located on two different servers both running Windows Server 2003 R2. Im am using SERVER1(SQL2000) as the Transactional publisher and distributor and SERVER2(SQL2005) is the subscriber. I can set up the publication and subscription but when I try to syncronize them...

update DB from layered architecture: best approach?

I'v e built a basic DAL which can retrieve data and a businesslayer with several objects using this DAL. Once I mapped the data into the business objects and done something with it, I also want to write the data back to the database. Some of the business objects have a lot of properties, so passing every value of a business object as par...

A glorious reporting tool

I'm in search of a glorious reporting tool. I'm aware that glorious is a subjective term but... here are my desires: Dead simple for business types Does not require me to speficy any SQL Can inspect the database's schema to interpret the users requests without programmer intervention Costs next to nothing Can save commonly crafted repo...

How do others set up foreign key relationships in migrations

Hi, I'm developing some things in Ruby on Rails, and I've currently got several models with relationships between them. Now, the models specify the relations, so I know that RoR will enforce integrity, but what about at the DB level ? Do other people set up foreign key relationships in DB tables ? and if so, how ?, there doesn't seem ...

Why restrict the length of a password?

I've just signed up to a site to purchase some goods, and when I tried to enter my (reasonably secure) password I was informed it was too long, and that I should enter a password between 5 & 10 characters! What is the point in that? Who makes decisions like this? Surely the ideal password would be a really long and complicated one? Why d...

Best practice: What is the best way to store exception/error or informational messages in C#.net for internationalization?

Hello gurus, When throwing custom exceptions or issuing messages to the end user, one could use hard-coded the strings (including string constants), use resource-only assemblies or get strings from a table in a database. I would like my application to be able to switch to a different language easily without having to recompile. While ...

when should I use the session-per-request pattern

I see this pattern everywhere, but Linq to SQL does not implement it. If Session/Unit-of-Work objects are lightweight (can be created and destroyed without performance penalty), and connection pooling keeps database connections alive, why and when do I need the session-per-request pattern? ...