I’m creating an installation script for an application that I’m developing and need to create databases dynamically from within PHP. I’ve got it to create the database but now I need to load in …
How can I create database tables from XSD files?
I have a set of XSDs from which I generate data access classes, stored procedures and more. What I don’t have is a way to generate database table from these – is there a tool that will generate the …
Moving from ints to GUIDs as primary keys
I use several referenced tables with integer primary keys. Now I want to change ints to GUIDs leaving all references intact. What is the easiest way to do it? Thank you! Addition I do understand …
Is there something wrong with joins that don’t use the JOIN keyword in SQL or MySQL?
When I started writing database queries I didn’t know the JOIN keyword yet and naturally I just extended what I already knew and wrote queries like this: Now that I know that this is the same as an INNER JOIN I find all these queries in my code and ask myself if I should rewrite them. Is there something smelly
Solutions for INSERT OR UPDATE on SQL Server
Assume a table structure of MyTable(KEY, datafield1, datafield2…). Often I want to either update an existing record, or insert a new record if it doesn’t exist. Essentially: IF (key exists) run …
A script to change all tables and fields to the utf-8-bin collation in MYSQL
Is there a SQL or PHP script that I can run that will change the default collation in all tables and fields in a database? I can write one myself, but I think that this should be something that readily available at a site like this. If I can come up with one myself before somebody posts one, I will
How to insert multiple records and get the identity value?
I’m inserting multiple records into a table A from another table B. Is there a way to get the identity value of table A record and update table b record with out doing a cursor? Create Table A (id …
How do I enforce data integrity rules in my database?
I’m designing this collection of classes and abstract (MustInherit) classes… This is the database table where I’m going to store all this… As far as the Microsoft SQL Server database knows, those are all nullable (“Allow Nulls”) columns. But really, that depends on the class stored there: LinkNode, HtmlPageNode, or CodePageNode. Rules might look like this… How do I enforce
Keep pagination repeatable if change operations are performed
If one wants to paginate results from a data source that supports pagination we have to go to a process of: defining the page size – that is the number of results to show per page; fetch each page requested by the user using an offset = page number (0 based) * page size show the results of the fetched
Difference between BYTE and CHAR in column datatypes
In Oracle, what is the difference between : and Answer Let us assume the database character set is UTF-8, which is the recommended setting in recent versions of Oracle. In this case, some characters take more than 1 byte to store in the database. If you define the field as VARCHAR2(11 BYTE), Oracle can use up to 11 bytes for