|
Just in case you did not take Richard seriously - DO NOT STORE DATES AS TEXT, USE THE DATETIME DATATYPE. This is the basis of your problem.
How do I make that red, can I make it flash, can I make it jump through the monitor and thump it into the desk?
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
use trunc(your_field name)= trunc(sysdate) or sysdate-1 for yesterday.
or trunc(field_name)='12-apr-2012'
|
|
|
|
|
i'm accessing this .sql file from a .ksh(script) file.
error-subprogram or cursor reference out of scope
{code}
declare
CURSOR cur AS select a from abc;
begin
for i in cur loop
dbms.putline('recored is' rec.recor_num);
end loop
|
|
|
|
|
What database is this for as it doesn't look like a SQL Server cursor
TSQL Cursor[^]
Lobster Thermidor aux crevettes with a Mornay sauce, served in a Provençale manner with shallots and aubergines, garnished with truffle pate, brandy and a fried egg on top and Spam - Monty Python Spam Sketch
|
|
|
|
|
It looks like Oracle PL/SQL to me(I used this 7+ months ago so I could be wrong...)
“That which can be asserted without evidence, can be dismissed without evidence.”
― Christopher Hitchens
|
|
|
|
|
Not used Oracle for a while but I would have a read of this Stackoverflow: pl-sql cursor[^]
it shows how you would construct your cursor. I think your problem is here
GugliMugli wrote: CURSOR cur AS select a from abc;
it should be
declare cursor cur is
select a from abc
Lobster Thermidor aux crevettes with a Mornay sauce, served in a Provençale manner with shallots and aubergines, garnished with truffle pate, brandy and a fried egg on top and Spam - Monty Python Spam Sketch
|
|
|
|
|
sorry..
i mentioned 'AS' instead of 'IS'..
the complete cursor is
CURSOR cur IS select a from abc.
this is oracle pl/sql..
|
|
|
|
|
|
hello my Friends
I do not convert sql server 2008 r2 database to sql server 2005
Please help me
|
|
|
|
|
You can't simply back up and restore as you would going the other way, so you are going to have to script the schema across and then write a script to transfer the data.
Red-Gate have tool that we use to do this job (usually between UAT and production, never 2008 => 2005)
[edit] Red-Gate are not free or cheap and it may not be worth it for a one off job [/edit]
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
|
I think you posted this reply to the wrong person, although from the titles I did not know you could use backup/restore, interesting.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
OK, thank you very much for your reply.
I moved my answer...
|
|
|
|
|
|
hi to all
i want to know that whats difference between below two query?
and which of those is better of another in performance respective?
SELECT ID INTO #TempLoan FROM bml.Loan WHERE id IN(1,2,100,700)
SELECT * FROM #TempLoan
and this query:
WITH TempLoan(id)
AS
(SELECT ID FROM BML.Loan WHERE id IN(1,2,100,700))
SELECT * FROM TempLoan
thank you for any idea
|
|
|
|
|
Here have some google foo[^]
The first thread seems to have a comprehensive discussion, try researching before dropping the question into a forum.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
|
I have the following stored procedure on MySQL. It's running perfectly the MySQL on my laptop but when I try to create it on my host server I am getting:
You have an error in your SQL syntax. check the manual that corresponds to yout mySQL server version for the right syntax to use near 'param_limit; END;
ELSE
BEGIN
SELECT event_log.event_log_date_time, even' at line 5
this is the stored procedure:
IF (param_limit IS NOT NULL) THEN
BEGIN
SELECT event_log.event_log_date_time, event_log.event_log_title FROM event_log WHERE event_log.event_log_member_id = param_member_id ORDER BY event_log.event_log_date_time DESC LIMIT param_limit;
END;
ELSE
BEGIN
SELECT event_log.event_log_date_time, event_log.event_log_title FROM event_log WHERE event_log.event_log_member_id = param_member_id ORDER BY event_log.event_log_date_time DESC;
END;
END IF;
Technology News @ www.JassimRahma.com
|
|
|
|
|
Caveat: I have absolutely no knowledge of MySQL, but the error message tells you precisely what you should do.
Jassim Rahma wrote: check the manual that corresponds to yout mySQL server version for the right syntax to use near 'param_limit; END;
I suspect they changed the syntax and you have an additional ; in your query.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
At a guess it does not like the semi-colons at the end of the statement(s), and/or the extra END; clause. However, in order to be sure you should check the manual.
Use the best guess
|
|
|
|
|
Which one of two below query is excellence of another?
and why?
thanks for your idea
query 1:
if @aa = 1
select @b = left(@a,10)
else
select @b = left(@c,10)
query 2:
SELECT @b = CASE WHEN @aa = 1 THEN LEFT(@a,10)
WHEN @aa = 2 THEN LEFT(@c,10)
END
|
|
|
|
|
The first query only checks for @aa =1. If @aa is not equal to 1, the second select is executed.
The second query checks for @aa = 1 or @aa = 2; if @aa is neither, then no select is executed.
|
|
|
|
|
The first thing isn't a query. And they are unequal, as Tim mentioned.
And have you considered: SELECT @b = LEFT(CASE @aa WHEN 1 THEN @a ELSE @c END ,10)
I expect they are all very similar in performance, but I would stick with pure SQL.
|
|
|
|
|
Hunting for micro-optimizations usually indicates that one is in need of a profiler, to discover where the real bottleneck is.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
ok thank you for reply.
but how can i do this ,i mean use of sql profiler for compare performance between two query?
thank you
|
|
|
|