Is there a simple way to modify a table in recent sqlite versions so that it matches a predefined schema?
Schema:
war_id INTEGER NOT NULL,
clanname VARCHAR(64),
clanhomepage VARCHAR(128),
date DATETIME,
server VARCHAR(64),
warmode_id INTEGER,
squad_id INTEGER,
notes TEXT, clantag String(16),
PRIMARY KEY (war_id),
FOREIGN KEY(w...
I have a database with collation SQL_Latin1_General_CP1_CI_AS. In that database I have a varchar field. There is a row in that database with the string "ó" (single character 243 in codepage 1252). I have a simple ASP page that sets the codepage to 65001, reads that row (using adodb), and sends it out to the browser. Everything works ...
is there a better way to write this SQL than using WHERE ... IN (subquery)?
SELECT device.mac, reseller.name, agent.name
FROM device
LEFT JOIN global_user
ON device.global_user_id = global_user.id
LEFT JOIN agent
ON global_user.id = agent.global_user_id
LEFT JOIN reseller
ON global_user.id = reseller.global_user_id...
I'm trying to figure out why a SQL Server stored procedure is executing slowly, so I've put in some crude timers, like this:
Create Procedure DoStuff
As Begin
Declare @Stopwatch datetime
Set @Stopwatch=GetDate()
Print char(13) + 'Task A'
/* Perform Task A */
Print DateDiff(ms, @Stopwatch, GetDate()); Set @Stopwatc...
I am using the database diagram to simply drag one column in a table to another to associate them and then trying to save it. i have done this a million times in the past with no problems. Both of the data types are the same, uniqueidentifier.
Here is the error I get:
'Customer ' table saved successfully
'CustomerOrder ' table
...
Often I deal with aggregate or parent entities which have attributes derived from their constituent or children members. For example:
The byte_count and packet_count of a TcpConnection object is computed from
the same attributes of its two constituent TcpStream objects, which in turn are
computed from their constituent TcpPacket objec...
Basically, the below image represents the components on the homepage of a site I'm working on, which will have news components all over the place. The sql snippets envision how I think they should work, I would really appreciate some business logic advice from people who've worked with news sites before though. Here's how I envision it:
...
Objective:
The intent of this query is to select all of the distinct values in one column that don't exist in a similar column in a different table.
Current Query:
SELECT DISTINCT Table1.Column1
FROM Table2, Table1
WHERE Table1.Column1 <> Table2.Column1
Results From Query:
What happens when I try to run this query is the progress ...
So, in my database, I store musical instrument names (and various other attributes). Let's say id is the primary key, and name is a unique key.
In a PHP script, I select items by their instrument class, like so:
$name = mysql_real_escape_string($_POST['name']);
$row = mysql_fetch_row(mysql_query("SELECT * FROM `instruments` WHERE name ...
Say you have the following many-to-many table relation:
user
-----
id
first_name
last_name
user_prefs
----------------
id
preference_name
user2user_prefs
-------------
id
user_id
user_pref_id
But say you have the user preference of "homepage" and need somewhere to store the actual homepage url. Where would that go?
I can't put a va...
I have manage to write images on an sql server 2008
But i see that in the image record writing the same bytes in all of the images
And also it creates on the remote disk under a special catalogue a file which finally is the image
Is there anybody which can explain me the flow chart of writing an image in sql server?
What is contain...
Hi,
This a bit looks complicated, i want to get the id column value of the processed query.
example:
$qu = mysql_query("INSERT INTO msgs (msg,stamp) VALUES('$v1','$v2')");
i want to get the ID of this query after storing the infos in database.
if it's impossible, is getting the last ID record and adding 1 will be safe and guaran...
Q1:
A: There are two tables in a telecom SQL Server database – Customers and Rates as shown below:
Customers
PK CustomerPhoneNumber varchar(15)
CustomerType int -the type of customer
Rates
FK CustomerType int - the type of customer
CountryCode varchar(4) – th...
I've got two models. One represents a piece of equipment, the other represents a possible attribute the equipment has. Semantically, this might look like:
Equipment: tractor, Attributes: wheels, towing
Equipment: lawnmower, Attributes: wheels, blades
Equipment: hedgetrimmer, Attributes: blades
I want to make queries like,
wheels = A...
I'm trying to run a query like this:
SELECT *
FROM
MyTable
WHERE
FirstName LIKE '%[user inputted value here]%'
OR
LastName LIKE '%[that same user inputted value]%'
AND
UserID = some number
When I run the query using cursor.execute(), the inputted values are going to be escaped and quoted, which is causi...
I have a table structure similar to:
Portfolios
Properties
Units
Leases
All tables are setup with foreign key relationships and cascade deletes. I want to be able to delete a portfolio, which would in turn delete all properties assigned to that portfolio, all units assigned to those properties, and all leases assigned to tho...
I have a customers table and I want to get the growth broken down by different periods say day, week, or year. To simplify let's assume there are only 2 columns:
CustomerID, CreatedOn
Trying to grasp this concept so I can apply it to several reports I want to make.
...
Hi, I have the following table:
----------- ---------- -----------
| AccountID | Password | IpAddress |
----------- ---------- -----------|
| 1 1234 127.0.0.1 |
| 2 123 127.0.0.1 |
| 3 1234 127.0.0.1 |
| 4 12 127.0.0.2 |
| 5 123 127.0.0.2 |
| 6 ...
When using ANT to build my Java application I keep getting this error. I have tried multiple times to use SQLJDBC.JAR and SQLJDBC4.JAR but continually receive this error message. I am completely stumpped why this error is received even after upgrading to sqljdbc4.jar.
[javadoc] java.lang.UnsupportedOperationException:
Java Runtime...
I'm having an issue getting a COUNT() from a SQL query using Zend_Db_Table_Select, and I think it may be a possible bug because the SQL it should be generating actually works. Here's the Zend Select Query: ($this is a Zend_Db_Table, renamed to table1 in this example)
$select = $this->select();
$select->setIntegrityCheck(false);...