Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

¼ÆËãÄê×ʵÄSQLÓï¾ä

1.bzscs(ɳ³æ ÎÒ°®Ð¡ÃÀ)Óú¯數µÄºÃ辦·¨:
CREATE    function [dbo].[calc_date](@time smalldatetime,@now smalldatetime)
returns nvarchar(10)
as
begin
declare @year int,@month int,@day int
select @year = datediff(yy,@time,@now)
if  (month(@now)=month(@time)) and (day(@now)<day(@time)) or (month(@now)<month(@time))
  set @year = @year-1
select @month = datediff(month,@time,@now)-12*@year
if(day(@now)<day(@time))
  set @month = @month-1
select @day = datediff(dd,dateadd(month,(12*@year+@month),@time),@now)
return cast(@year as varchar) + 'Äê'+ cast(@month as varchar)+'個ÔÂ'+cast(@day as varchar)+'Ìì'
end
GO
-------------------------------------------------------------------------------------
--調Óú¯數 :
--1.ijһ¾ß體ÈÕÆÚ
declare @kk nvarchar(10)
select @kk = [dbo].[calc_date]('2001-11-28',getdate())
print @kk
--2.數據±íµÄ'Èë職ÈÕÆÚ'×Ö¶Î
select empno,indate,[dbo].[calc_date](indate,getdate()) from employee


Ïà¹ØÎĵµ£º

JAVAÁ¬½ÓACCESS£¬SQL Server,MySQL,Oracle

import java.sql.*;
/*
* JAVAÁ¬½ÓACCESS£¬SQL Server,MySQL,OracleÊý¾Ý¿â
*
* */
public class JDBC {
  
public static void main(String[] args)throws Exception {
  
   Connection conn=null;
  
       //====Á¬½ÓACCESSÊý¾Ý¿â ......

[ÊÕ£] ÓÃsqlite Ö´Ðбê×¼ sql Óï·¨

http://www.umgr.com/blog/PostView.aspx?bpId=36294
 1. Ö´ÐÐsqlÓï¾ä
int sqlite3_exec(sqlite3*£¬ const char *sql£¬ sqlite3_callbacksql Óï·¨
£¬ void *£¬  char **errmsg );
Õâ¾ÍÊÇÖ´ÐÐÒ»Ìõ sql Óï¾äµÄº¯Êý¡£
µÚ1¸ö²ÎÊý²»ÔÙ˵ÁË£¬ÊÇÇ°Ãæopenº¯ÊýµÃµ½µÄÖ¸Õ롣˵ÁËÊǹؼüÊý¾Ý½á¹¹¡£
µÚ2¸ö²ÎÊýconst char ......

(ת)SQL ²éÕÒÖظ´¼Ç¼

±ístuinfo£¬ÓÐÈý¸ö×Ö¶Îrecno(×ÔÔö),stuid,stuname
½¨¸Ã±íµÄSqlÓï¾äÈçÏ£º
CREATE TABLE [StuInfo] (
[recno] [int] IDENTITY (1, 1) NOT NULL ,
[stuid] [varchar] (10) COLLATE Chinese_PRC_CI_AS NOT NULL ,
[stuname] [varchar] (10) COLLATE Chinese_PRC_CI_AS NOT NULL
) ON [PRIMARY]
GO
1.--²éijһÁ ......

oracle sqlÓÅ»¯Ö®¶à±íÁ¬½ÓÓÅ»¯


Use equality first.
ʹÓõÈÁ¬½Ó
Use range operators only where equality does not apply.
Ö»ÓÐÔÚµÈÁ¬½Ó²»¿ÉÓõÄÇé¿öÏÂÊÂÓÉÇø¼äÁ¬½Ó
Avoid use of negatives in the form of !=
or NOT.
±ÜÃâʹÓà £¡= »òÕß not
Avoid LIKE pattern matching.
±ÜÃâʹÓà LIKEÆ¥Åä
Try to retrieve specific rows and in small n ......

ÖØбàÒëËùÓÐÎÞЧµÄPL/SQLÄ£¿é£¨¶ÔÏó£©

µ±OracleÊý¾Ý¿â´´½¨Íê³Éºó£¬ÏµÍ³½«»á×Ô¶¯ÔËÐÐutlrp.sqlÕâ¸ö½Å±¾Îļþ£¨D:\oracle\product\10.1.0\Db_1\RDBMS\ADMIN£©£¬µ«ÊÇ£¬µ±Í¨¹ý¶¨ÖÆ°²×°ÀàÐ͵ķ½Ê½´´½¨ÁËÊý¾Ý¿âʱ£¬ÏµÍ³Ôò²»»áÔËÐÐutlrp.sqlÕâ¸ö½Å±¾£¬ËùÒÔ£¬½¨ÒéÔÚ´´½¨¡¢¸üлòǨÒÆÒ»¸öÊý¾Ý¿âºó£¬ÔËÐÐÒ»ÏÂutlrp.sqlÕâ¸ö½Å±¾£¬ÒÔÑéÖ¤Êý¾Ý¿â°²×°ÊÇ·ñ³É¹¦£¬ÕâÑù¿ÉÒÔÖØбàÒë ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ