|
|
Suppose some one purchased a ticket online. [Here the value of a column is pending]
If the person does not pay the cash money within 24 hours than the ticket will be automatically cancelled. [The value of the status column will be cancelled after 24 hours]
So,
How can I do automatic update of a table after 24 hours???
|
|
|
|
|
Easiest way would be to run a job[^] at a specified interval that checks the table and does whatever it needs to do.
"If you think it's expensive to hire a professional to do the job, wait until you hire an amateur." Red Adair.
nils illegitimus carborundum
me, me, me
|
|
|
|
|
You have done this using sql server. But How can I do this for oracle??
|
|
|
|
|
AhmedMasum wrote: Suppose some one purchased a ticket online. [Here the value of a column is pending]
If the person does not pay the cash money within 24 hours than the ticket will be automatically cancelled. [The value of the status column will be cancelled after 24 hours]
It's not pending, it's reserved from that moment forward. Otherwise you could run into the problem that there's more pending than there's actually available.
AhmedMasum wrote: How can I do automatic update of a table after 24 hours???
I'd run through it once an hour, processing the valid payments (sending out a ticket to an address) and the invalid ones.
I are Troll
|
|
|
|
|
I wouldn't; I'd design the system so that that isn't required. The Pending column should be a date column that is set to the time when it will expire if not Purchased. Then, when seeking available tickets, look for any where the Pending field is null or less than the current time and Purchased (another date field) is also null.
Or name them Ordered and Purchased or something, but I wouldn't put them in a single Status column, Status could be calculated from a number of fields, including Shipped.
|
|
|
|
|
Thanks for your nice suggestion!!!.
My above case is just an example.
Actually I need something that will do insert/update/delete on a table every week or after a specific period of time.
Is there any type of trigger can do this type of operation??
|
|
|
|
|
Use a Windows Service (for very frequent actions) or a Windows Scheduled Task (for less-frequent actions).
|
|
|
|
|
Hi
I have not installed mysql on my own, its the default one that is coming with fedora14 at /usr/local/mysql
I am giving you some screenshots, please check if you can find out something.
*********************************************************************************************************************************************************
The first issue is while I login using command
mysql -u root -p
it asks for password I enter, root123
then gives the error
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
let me give you the full flow:
I am using fedora 14
_________________________________________________________________________________________________________
in root I fire the below commands:
[starting the mysql]
[root@chandan init.d]# /etc/init.d/mysqld start
Starting mysqld: [ OK ]
now from my local account I try to login to sql,
[chadan@chandan ~]$ mysql -u root -p
Enter password:
[i give password as root123
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
But when I login using command
[chadan@chandan ~]$ mysql
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 3
Server version: 5.1.51 Source distribution
Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
This software comes with ABSOLUTELY NO WARRANTY. This is free software,
and you are welcome to modify and redistribute it under the GPL v2 license
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql>
[here I am able to login to server but when I try to create database then it gives error]
mysql> create database dummy;
ERROR 1044 (42000): Access denied for user ''@'localhost' to database 'dummy'
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| test |
+--------------------+
**********************************************************************************************************************************
NOW THE SECOND ISSUE WHEN I START THE SERVER IN DIFFERENT WAY.
[root@chandan init.d]# mysqld_safe --skip-grant-tables &
[1] 29006
[root@chandan init.d]# 110219 18:33:25 mysqld_safe Logging to '/var/log/mysqld.log'.
110219 18:33:25 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
Now from my account I try to login
[chadan@chandan ~]$ mysql -u root -p
Enter password: fsklfjfljf
here whatever password I give I am able to login
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.1.51 Source distribution
Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
This software comes with ABSOLUTELY NO WARRANTY. This is free software,
and you are welcome to modify and redistribute it under the GPL v2 license
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| test |
+--------------------+
3 rows in set (0.00 sec)
now when I check mysql database
mysql> use mysql
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Database changed
mysql> show tables;
+---------------------------+
| Tables_in_mysql |
+---------------------------+
| columns_priv |
| db |
| event |
| func |
| general_log |
| help_category |
| help_keyword |
| help_relation |
| help_topic |
| host |
| ndb_binlog_index |
| plugin |
| proc |
| procs_priv |
| servers |
| slow_log |
| tables_priv |
| time_zone |
| time_zone_leap_second |
| time_zone_name |
| time_zone_transition |
| time_zone_transition_type |
| user |
+---------------------------+
23 rows in set (0.01 sec)
mysql> select host,user,password,Insert_priv,update_priv from user;
+---------------------- +------+---------- +-------------+-------------+
| host | user | password | Insert_priv | update_priv |
+---------------------- +------+---------- +-------------+-------------+
| localhost | root | root123 | Y | Y |
| username.corp.org.in | root | root123 | Y | Y |
| 127.0.0.1 | root | root123 | Y | Y |
| localhost | | | N | N |
| username.corp.org.in | | N | N |
+----------------------+------+----------+-------------+-------------+
5 rows in set (0.00 sec)
[here you can see that the password for root user is root123,
now here if i try to create database i am able to do that
mysql> create database dummy;
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| dummy |
| mysql |
| test |
+--------------------+
4 rows in set (0.00 sec)
I dont know how to solve this also I tried to create another user but it denied
mysql> CREATE USER 'seen' IDENTIFIED BY 'seen123';
ERROR 1290 (HY000): The MySQL server is running with the --skip-grant-tables option so it cannot execute this statement
|
|
|
|
|
Check this[^], looks like it could be that the root password could be incorrect. The MySQL root password could be different to your OS root password.
It could also be that there is a port conflict which is why it works when you start it in a different way.
|
|
|
|
|
hi..
i've created an report in which i want to change the color of
the particular word i've four words which i want to change the
color
john,steve,mike,and danial..
for these name where ever they appear in the row the color should change
is it possible..
??
|
|
|
|
|
Hi,
You can use BackgroundColor-property to change the color and define an expression how the color is set. What comes to the color itself, you can for example resolve the color in the formula or add an extra field to your query which defines the color, like:
SELECT ...
CASE
WHEN LOWER(table.NameField) LIKE '%john%' THEN 'Red'
WHEN LOWER(table.NameField) LIKE '%steve%' THEN 'Blue'
...
ELSE 'White'
END AS BackgroundColor,
...
FROM ...
Now each row should have a color field which you can use in the expression for the BackgroundColor-property. If you want to do this in more elegant way you can create a table for the name/color pairs and use that table for lookups and possibly create a small T-SQL function for the logic.
|
|
|
|
|
I have a Software which is having SQL Server Database, Most of the users don't want to buy SQL Server, So as Microsoft has SQL Express, Can i bundled SQL Express in my Setup CD,
means can i redistribute it ?
SOFTDEV
Luck in life always exists in the form of an abstract class that cannot be instantiated directly and needs to be inherited by hard work and dedication.
|
|
|
|
|
|
Thanks
SOFTDEV
Luck in life always exists in the form of an abstract class that cannot be instantiated directly and needs to be inherited by hard work and dedication.
|
|
|
|
|
No problem
|
|
|
|
|
Just put instructions in the documentation.
|
|
|
|
|
Good advice
|
|
|
|
|
Thanks
SOFTDEV
Luck in life always exists in the form of an abstract class that cannot be instantiated directly and needs to be inherited by hard work and dedication.
|
|
|
|
|
Thanks.
SOFTDEV
Luck in life always exists in the form of an abstract class that cannot be instantiated directly and needs to be inherited by hard work and dedication.
|
|
|
|
|
I’m trying to insert a new record into an MS Access (2002-2003) database using Perl. My instructor's example has me getting the last record ID and using that to generate the next ID.
Two things:
1- When I do this the way the instructor illustrates (based on existing ID) using this code:
if($db->Sql("SELECT MAX(ID) lastID FROM Test"))<br />
{<br />
print "SQL Error: " . $db->Error() . "\n";<br />
$db->Close();<br />
exit;<br />
}
Can anybody tell me why I'm getting this error:
SQL Error: [-3100] [1] [0] "[Microsoft][ODBC Microsoft Access Driver] Syntax error (missing operator) in query expression 'MAX(ID) lastID'."
2- If my ID field is set to “AutoNumber” shouldn’t I be able to simply insert and new record (with no ID)? I’ve attempted that with no success.
|
|
|
|
|
hi,
1. I think you need an as:
SELECT MAX(ID) AS lastID FROM Test
2. I should think so. And having two separate DB operations to first fetch then use MAX(ID) seems like a recipe for failure as soon as other users are also operating the DB.
Luc Pattyn [Forum Guidelines] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.
|
|
|
|
|
Thanks Luc. Aliasing did the trick.
|
|
|
|
|
Luc Pattyn wrote: having two separate DB operations to first fetch then use MAX(ID) seems like a recipe for failure
Indeed it does. Using for example @@IDENTITY would be safer.
|
|
|
|
|
Hi
For the first question: You could try adding the keyword AS for the column:
if($db->Sql("SELECT MAX(ID) AS lastID FROM Test"))
And for the second question. Yes if the field is autonumbered, you don't have to mention it in an INSERT statement just like you don't have to mention any field that has a default value. However, if you're later going to add something for this row to a child table of this table you need to know the value for the foreign key in the child table.
|
|
|
|