hibernateɾ³ý²Ù×÷µÄsqlÓï¾äд·¨
µÚÒ»ÖÖ£º
public void deleteUser(String byemail) {
Session session = getSession();
Transaction transaction = null;
String hql = "delete from Register where email=?
";
try {
transaction = session.beginTransaction();
System.out.println(hql);
Query q = session.createQuery(hql);
System.out.println(q);
q.setParameter(0,byemail);//ÕâÀïÓÃsetParameter
(int position, Object val)
System.out.println("q+++++++");
q.executeUpdate();
System.out.println("update");
transaction.commit();
System.out.println("commit");
} catch (HibernateException e) {
// TODO Auto-generated catch block
e.printStackTrace();
if (transaction != null) {
// µ±·¢ÉúÒ쳣ʱ»Ø¹öÊÂÎñ£¬È¡ÏûÊý¾Ý¿â²Ù×÷
transaction.rollback();
System.out.println("#######ɾ³ý·¢ÉúÒì³££¬ÊÂÎñ»Ø¹ö#########");
}
} finally {
session.close();
}
µÚ¶þÖÖ£º
public void deleteUser(String byemail
) {
Session session = getSession();
Transaction transaction = null;
String hql = "delete from Register where email=:byemail
";
try {
transaction = session.beginTransaction();
System.out.println(hql);
Query q = session.createQuery(hql);
System.out.println(q);
q.setParameter("byemail
",byemai
l);
System.out.println("q+++++++");
q.executeUpdate();
System.out.println("update");
transaction.commi
Ïà¹ØÎĵµ£º
1.½¨±í
create table temp(rq varchar(10),shengfu nchar(1))
2.²åÈëÊý¾Ý
insert into temp values('2005-05-09','ʤ')
insert into temp values('2005-05-09','ʤ')
insert into temp values('2005-05-09','¸º')
insert into temp values('2005-05-09','¸º')
insert into temp values('2005-05-10','ʤ')
insert i ......
¶ÔÓÚ·þÎñÆ÷ÉÏÊý¾ÝµÄ±¸·Ý¹¤×÷ÊÇÍø¹ÜÔ±ÈÕ³£¹¤×÷ÖÐ×îÖØÒªµÄ¹¤×÷Ö®Ò»£¬SQLServerAgent·þÎñʹµÃÎÒÃÇ¿ÉÒÔÓÃSQLÉϵēÊý¾Ý¿âά»¤¼Æ»®”¹¦
ÄÜÀ´×Ô¶¯±¸·ÝÊý¾Ý£¬µ«×î½üÎÒ·¢ÏÖ·þÎñÆ÷ÉÏSQLServerAgent·þÎñÎÞ·¨Æô¶¯ÁË£¬»ØÏë×î½üËù×öµÄ²Ù×÷£¬ÔÀ´ÊÇÒòΪÎÒ°ÑSQLÖÐ
Builtin/AdministratorsÕâ¸öÕʺŵķþÎñÆ÷·ÃÎÊȨÏÞ½ûÖ¹ ......
Ò»¡¢PL/SQL³öÏÖµÄÄ¿µÄ
¡¡¡¡½á¹¹»¯²éѯÓïÑÔ(Structured Query
Language£¬¼ò³ÆSQL)ÊÇÓÃÀ´·ÃÎʹØϵÐÍÊý¾Ý¿âÒ»ÖÖͨÓÃÓïÑÔ£¬ËüÊôÓÚµÚËÄ´úÓïÑÔ£¨4GL£©£¬ÆäÖ´ÐÐÌصãÊǷǹý³Ì»¯£¬¼´²»ÓÃÖ¸Ã÷Ö´ÐеľßÌå·½·¨ºÍ;
¾¶£¬¶øÊǼòµ¥µÄµ÷ÓÃÏàÓ¦Óï¾äÀ´Ö±½ÓÈ¡µÃ½á¹û¼´¿É¡£ÏÔÈ»£¬ÕâÖÖ²»¹Ø×¢ÈκÎʵÏÖϸ½ÚµÄÓïÑÔ¶ÔÓÚ¿ª·¢ÕßÀ´ËµÓÐ׿«´óµÄ ......
/*
--×÷ÓãºSQL SERVER²Ù×÷ACCESSµÄ´æ´¢¹ý³Ì
----------------------Ó÷¨-------------------------------
--´´½¨±ítc
exec sp_operate_access 'create table tc(id int)','c:\db1.mdb'
go
--ÔÚtc±í²åÈëÊý¾Ý
exec sp_operate_access 'insert into tc(id) values(1)','c:\db1.mdb'
go
--ɾ³ýtc±íµÄÊý¾Ý
exec sp_op ......
SQLº¯ÊýÖ®ËÄÉáÎåÈ루ת×Ôhttp://ln1058.javaeye.com/blog/191502£©
ÎÊÌâ1£º
SELECT CAST('123.456' as decimal) ½«»áµÃµ½ 123£¨Ð¡ÊýµãºóÃæµÄ½«»á±»Ê¡ÂÔµô£©¡£
Èç¹ûÏ£ÍûµÃµ½Ð¡ÊýµãºóÃæµÄÁ½Î»¡£
ÔòÐèÒª°ÑÉÏÃæµÄ¸ÄΪ
SELECT CAST('123.456' as decimal(38, 2)) ===>123.46
×Ô¶¯ËÄÉáÎåÈëÁË£ ......