Am looking for how I can extend the Zend_DB_Table below to accomodate a BETWEEN two dates syntax and LIMIT syntax
My current construct is
class Model_DbTable_Tablelist extends Zend_Db_Table_Abstract
{
protected $_name = 'mytable';
$select = $this->select()
->setIntegrityCheck(false)
->fr...
Allowing NULL values on a column is normally done to allow the absense of a value to be represented. When using NVARCHAR there is aldready a possibility to have an empty string, without setting the column to NULL. In most cases I cannot see a semantical difference between an NVARCHAR with an empty string and a NULL value for such a colum...
I'm using MySQL and I have the following table:
| clicks | int |
| period | date |
I want to be able to generate reports like this, where periods are done in the last 4 weeks:
| period | clicks |
| 1/7 - 7/5 | 1000 |
| 25/6 - 31/7 | .... |
| 18/6 - 24/6 | .... |
| 12/6 - 18/6 | .... |
or in the last 3 months:
...
Hi,
What does this mean within my like statement?
LIKE '%[ .,!?]' + keyword + '[ .,!?]%'
I'm trying to get something, that will match for whole words
...
I have a requirement to run a query against a database that will return either a zero or one
(Checking for existance of specific criteria).
The Tech specs I've been given for review state that I should be creating a stored procedure, that will return a single row, with a single column called "result" that will contain a bit value of 0 or...
I have tables in which 35000 to 40000 records are available. Inspite using ajax the performance of the website is very low. Can any body please suggest some ideas or tips for the problem. Thanks in advance.
...
Hi.. I want to update my database using formatsqlparam, but when I debug it, it has an error saying:
"Incorrect syntax near ','."
This is my code:
Dim sql2 As String = "update infoHotel set nameHotel = N" & FormatSqlParam(hotel) & _
", knownAs1 = N" & FormatSqlParam(KnownAs(0)...
Is it allowed to reference external field from nested select?
E.g.
SELECT
FROM ext1
LEFT JOIN (SELECT * FROM int2 WHERE int2.id = ext1.some_id ) as x ON 1=1
in this case, this is referencing ext1.some_id in nested select.
I am getting errors in this case that field ext1.some_id is unknow.
Is it possible? Is there some other way?
UP...
Is there a way to display the output of a sqlplus command without having to first issue the spool off command?
I am spooling the results of a sqlplus session to a file while at the same time tailing the file. The reason for this is that for table with very long rows the format is easier to look at from a file. The problem is to see the...
Hi,
Not able to execute a query ,i need to check if end date is greater than today in the following query
Getting an error invalid query
select * from table1 where user in ('a') and END_DATE >'2010-05-22'
getting an error liter string does not match
...
I know how to get the columns that would be returned from a select statement but how do I get the entities that would be returned from an sqlalchemy.orm.Query object?
>>> sess = Session()
>>> q = sess.query(Entity1, Entity2)
>>> q.statement.c.keys()
['e1_col1', 'e1_col2', ..., 'e2_col1', 'e2_col2, ...]
I want [Entity1, Entity2] or som...
create table v (mydate,value)
as
select to_date('20/03/2010 00','dd/mm/yyyy HH24'),98 from dual union all
select to_date('20/03/2010 01','dd/mm/yyyy HH24'),124 from dual union all
select to_date('20/03/2010 02','dd/mm/yyyy HH24'),140 from dual union all
select to_date('20/03/2010 03','dd/mm/yyyy HH24'),138 from dual union all
select to_d...
how to
compare the values of same table(say for eg: Order table) each and every time the record get inserted ,
if the record with same values get inserted already in same table i should not insert the new record with same values. how to do that exactly in sql server 2008
...
Hi,
I have a report in report services 2005 that has two date fields. The problem is that if users run this for a large section of time it uses too much resources on our server.
It is possible to only allow the end user to enter the start date and then the end date be auto populated/derived from this field (for example they enter the 1s...
Hi, I'm creating locally a big database using MySQL and PHPmyAdmin. I'm constantly adding a lot of info to the database. I have right now more than 10MB of data and I want to export the database to the server but I have a 10MB file size limit in the Import section of PHPmyAdmin of my web host.
So, first question is how I can split the d...
is it going to be faster if instead of doing
select * from users where id = 1
or
delete from users where id = 1
or
select count(*) from users
I would create a SP for it ?
...
Let's suppose I want to inform the application about what happened / returned the SQL server. Let's have this code block:
BEGIN TRY
-- Generate divide-by-zero error.
SELECT 1/0;
END TRY
BEGIN CATCH
SELECT
ERROR_NUMBER() AS ErrorNumber,
ERROR_SEVERITY() AS ErrorSeverity,
ERROR_STATE() as ErrorState,
...
I have a table which contains data in different languages. All fields are nvarchar(max).
I created a stored procedure which trim values of all the fields
Create Proc [dbo].[TrimValues]
as
update testdata
set city = dbo.trim(city),
state = dbo.trim(state),
country = dbo.trim(country),
schoolname = dbo.trim(schoolname)
after trim all ...
I'm need to write a stored procedure for SQL Server 2008 for performing a large select query and I need it to filter results with specifying filtering type via procedure's parameters. I found some solutions like this:
create table Foo(
id bigint, code char, name nvarchar(max))
go
insert into Foo values
(1,'a','aaa'),
(2,'b','bbb')...
Hi folks.
In SQL I (sadly) often have to use "LIKE" conditions due to databases that violate nearly every rule of normalization. I can't change that right now. But that's irrelevant to the question.
Further, I often use conditions like WHERE something in (1,1,2,3,5,8,13,21) for better readability and flexibility of my SQL statements.
...