I have column with values that have wrong character ?. Now I want to change it to character b. For this I am using this statement:
SELECT REPLACE(name,'?','b') from contacts;
But when I do this nothing's happening, it return value with ?.
What I am doing wrong? How I can replace this?
...
I've developed a billing summary page use mysql + php.
there are many users : (1M)
light user :each has less than 10K record :0.99M users
heavy user :each has about 1M record
SQL is the following :
SELECT SUM(value_a) A, SUM(value_b) B, SUM(value_c) C
FROM daily_data_sep_2010
WHERE user_id='<user_id>'
AND type
IN (
'type_a', ...
I have this data in postgresql
id | rate | hrv | activity | orientation | timestamp | user_id | status
----------+-----------+-----+----------+-------------+------------------------+---------+--------------
66764728 | 72 | 1 | 0 | 90 | 2010-06-10 18:54:54+00 | 397 | t
66764729 | ...
Hi, I'm using a method in the EnterpriseLibrary.Data.Database namespace called
public virtual object ExecuteScalar(DbCommand command)
I'm wanting to use this method to execute a scalar-valued function. However the I'm not sure how to even create the DbCommand.
Could someone please tell me how to create it because it won't let me inst...
I'm using the following code to restore a backup sql database with C# and SMO.
void RestoreDatabaseWithSMO(string sConnect, string dbName, string backUpPath)
{
using (SqlConnection cnn = new SqlConnection(sConnect))
{
cnn.Open();
cnn.ChangeDatabase("master");
ServerConnection sc = new ServerConnection(cn...
I have two tables as follows:
TABLE A TABLE B
StuID | actid FacID | actid
3 12 98 17
5 17 54 21
I want to list the name of everyone, both students and faculty, who participate in activity 17. Is there anyway I can get a result as below:
...
I've looked through all the related questions, but none of them does exactly what I need. I have two identically-structured tables (id, VoucherNbr, BalanceInit) - one is from our current production system (tableA), and the other is from a client's legacy system (tableB). Table A has records a,b,c,d,e (for example), and table B has a,b,c,...
Looking through some apache logs, I've run into the following pattern several times (URL decoded):
GET /foo.php?id=1 and union select 0x5E5B7D7E,0x5E5B7D7E,0x5E5B7D7E,... --
Clearly this is an SQL injection attempt. But why the constant shown above? I can't see how it could be particularly significant, though it seems to appear quite ...
Hi,
I need to write a query like SELECT substring(variable, startPosIndex, endPos) from Blah blah ;
startPostIndex = indexPosition('#')
endPos = lenght(variable) - 1;
So basically my query to access will be
SELECT substring(variable, indexPosition('#'), lenght(variable) - 1) from Blah blah ;
The query that I have written to get if...
I'm tuning my query for mysql.
the schema has index of user_id (following..)
but the index is not used. why?
Env:
MySQL4.0.27,MyISAM
SQL is the following :
SELECT type,SUM(value_a) A, SUM(value_b) B, SUM(value_c) C
FROM big_record_table
WHERE user_id='<user_id>'
GROUP BY type
Explain:
|table |type |possible_keys |key |key_len...
I tried the solution given in "mysql SELECT COUNT(*) … GROUP BY … not returning rows where the count is zero" but it didn't work for me.
Here is SQL ::
SELECT empid, SUM (total_records) total_records
FROM (SELECT ID,
(CASE WHEN ID LIKE '2%' THEN '2____'
WHEN ID LIKE '3%' THEN '3____'
...
With SQL Plus for Oracle Database, I can call
SET autotrace on
and then see Execution Plan, statistics, etc.
The problem is that I want access to information about the Execution Plan and statistics in my Java program. I typically have done something like this to execute a sql statement,
Connection connection = //INITIALIZE HERE;
St...
I'm reading about indexes in my database book and I was wondering if I was correct in my assumption that a WHERE clause with a non-constant expression in it will not use the index.
So if i have
SELECT * FROM statuses WHERE app_user_id % 10 = 0;
This would not use an index created on app_user_id. But
SELECT * FROM statuses WHERE app_...
Hi, I'm trying to set a variable from a SQL query:
declare @ModelID uniqueidentifer
Select @ModelID = select modelid from models
where areaid = 'South Coast'
Obviously I'm not doing this right as it doesn't work. Can somebody suggest a solution?
Thanks!
...
Hi all,
i want migrate a database from Sql Server 2008 to MySql using a the tool MySql Migration Toolkit but when the tool is establishing the database connection i receive this error :
Connecting to source database and retrieve schemata names.
Initializing JDBC driver ...
Driver class MS SQL JDBC Driver
Opening connection ...
Connec...
Hello there,
How to make query in sql to delete all record exist in every table.
There possible to write every name table using command delete. But it will take long time to write every single name table.
I am already try DELETE FROM * in MySQL but it got error:
You have an error in your SQL syntax; check the manual that correspond...
I have a variable defined as
define dbs '&1'
Suppose I pass database1 as an argument. Then the statement is interpreted as
define dbs database1
I want to append single quotes around the string, ie I want it to be interpreted as
define dbs 'database1'
How should I do this?
...
I'm curious to know, "what if I delete information_schema database from mySQL?"
...
How do you work with the oracle XML data type?
This question is intended to be asked and answered by me, just to share the information with others
...
Hi,
I get a customer name from dropdown and use that value to query an excel spreadsheet, however, the name can contain a single quote (example: Adam's Meat). This breaks my application and how do I make a query with a variable that contains a single quote?
Private Sub cboCompany_Change()
Dim customerName As String
...