1.¾ø¶ÔÖµ
S:select abs(-1) value
O:select abs(-1) value from dual
2.È¡Õû(´ó)
S:select ceiling(-1.001) value
O:select ceil(-1.001) value from dual
3.È¡Õû£¨Ð¡£©
S:select floor(-1.001) value
O:select floor(-1.001) value from dual
4.È¡Õû£¨½ØÈ¡£©
S:select cast(-1.002 as int) value
O:select trunc(-1.002) value from dual
5.ËÄÉáÎåÈë
S:select round(1.23456,4) value 1.23460
O:select round(1.23456,4) value from dual 1.2346
6.eΪµ×µÄÃÝ
S:select Exp(1) value 2.7182818284590451
O:select Exp(1) value from dual 2.71828182
7.È¡eΪµ×µÄ¶ÔÊý
S:select log(2.7182818284590451) value 1
O:select ln(2.7182818284590451) value from dual; 1
8.È¡10Ϊµ×¶ÔÊý
S:select log10(10) value 1
O:select log(10,10) value from dual; 1
9.ȡƽ·½
S:select SQUARE(4) value 16
O:select power(4,2) value from dual 16
10.ȡƽ·½¸ù
S:select SQRT(4) value 2
O:select SQRT(4) value from dual 2
11.ÇóÈÎÒâÊýΪµ×µÄÃÝ
S:select power(3,4) value 81
O:select power(3,4) value from dual 81
12.È¡Ëæ»úÊý
S:select r ......
1.¾ø¶ÔÖµ
S:select abs(-1) value
O:select abs(-1) value from dual
2.È¡Õû(´ó)
S:select ceiling(-1.001) value
O:select ceil(-1.001) value from dual
3.È¡Õû£¨Ð¡£©
S:select floor(-1.001) value
O:select floor(-1.001) value from dual
4.È¡Õû£¨½ØÈ¡£©
S:select cast(-1.002 as int) value
O:select trunc(-1.002) value from dual
5.ËÄÉáÎåÈë
S:select round(1.23456,4) value 1.23460
O:select round(1.23456,4) value from dual 1.2346
6.eΪµ×µÄÃÝ
S:select Exp(1) value 2.7182818284590451
O:select Exp(1) value from dual 2.71828182
7.È¡eΪµ×µÄ¶ÔÊý
S:select log(2.7182818284590451) value 1
O:select ln(2.7182818284590451) value from dual; 1
8.È¡10Ϊµ×¶ÔÊý
S:select log10(10) value 1
O:select log(10,10) value from dual; 1
9.ȡƽ·½
S:select SQUARE(4) value 16
O:select power(4,2) value from dual 16
10.ȡƽ·½¸ù
S:select SQRT(4) value 2
O:select SQRT(4) value from dual 2
11.ÇóÈÎÒâÊýΪµ×µÄÃÝ
S:select power(3,4) value 81
O:select power(3,4) value from dual 81
12.È¡Ëæ»úÊý
S:select r ......
ÿ´Î´ò¿ªSQLServer²éѯ·ÖÎöÆ÷ºó£¬ÔÚÁ¬½Ó´°¿ÚÀïµÄSQLServer·þÎñÆ÷Ñ¡ÔñÏÂÀ¿òºÍµÇ¼Óû§ÃûÊäÈë¿òÀﶼ»áÁôÓÐÀúÊ·µÇ¼µÄ¼Ç¼£¬ÓÐʱºòÎÒÃÇÊDz»Ï£ÍûÕâÑùµÄ£¬±ÈÈçÔÚÒ»¸ö·Ç˽ÓÐÁìµØ×öÁËÔÝʱµÄ¿ª·¢ºó£¬²»ÏëÁôÏÂÈκÎÁ¬½ÓÔ¶³ÌÊý¾Ý¿âµÄ¼Ç¼£¬ÈçºÎɾ³ýÄØ£¿»¹ÊÇ×¢²á±í£¬ÕÒµ½ÒÔÏ·¾¶£º
HKEY_CURRENT_USER\Software\Microsoft\Microsoft SQL Server\80\Tools\Client\PrefServers
ÔÚÀïÃæÕÒµ½ÄãҪɾµÄ¼Ç¼£¬ÓÒ¼üɾ³ý¼´¿É ......
using System.Data.SqlClient;
using System.Data.OleDb;
private void button1_Click(object sender, EventArgs e)
{
OleDbConnection conn = null;
try
{
string path = "./Users.xls";
string strConn;
strConn = "Provider=Microsoft.Jet.OLEDB.4.0;" +
"Data Source=" + path + ";" +
"Extended Properties='Excel 8.0;HDR=Yes;IMEX=1;'";
......
using System.Data.SqlClient;
using System.Data.OleDb;
private void button1_Click(object sender, EventArgs e)
{
OleDbConnection conn = null;
try
{
string path = "./Users.xls";
string strConn;
strConn = "Provider=Microsoft.Jet.OLEDB.4.0;" +
"Data Source=" + path + ";" +
"Extended Properties='Excel 8.0;HDR=Yes;IMEX=1;'";
......
SQLServerʱ¼äÈÕÆÚº¯ÊýÏê½â,SQLServer,ʱ¼äÈÕÆÚ,
1. µ±Ç°ÏµÍ³ÈÕÆÚ¡¢Ê±¼ä
select getdate()
2. dateadd ÔÚÏòÖ¸¶¨ÈÕÆÚ¼ÓÉÏÒ»¶Îʱ¼äµÄ»ù´¡ÉÏ£¬·µ»ØÐ嵀 datetime Öµ
ÀýÈ磺ÏòÈÕÆÚ¼ÓÉÏ2Ìì
select dateadd(day,2,'2004-10-15') --·µ»Ø£º2004-10-17 00:00:00.000
3. datediff ·µ»Ø¿çÁ½¸öÖ¸¶¨ÈÕÆÚµÄÈÕÆÚºÍʱ¼ä±ß½çÊý¡£
select datediff(day,'2004-09-01','2004-09-18') --·µ»Ø£º17
select datediff(day,'2004-09-18','2004-09-01') --·µ»Ø£º-17
4. datepart ·µ»Ø´ú±íÖ¸¶¨ÈÕÆÚµÄÖ¸¶¨ÈÕÆÚ²¿·ÖµÄÕûÊý¡£
SELECT DATEPART(month, '2004-10-15') --·µ»Ø 10
5. datename ·µ»Ø´ú±íÖ¸¶¨ÈÕÆÚµÄÖ¸¶¨ÈÕÆÚ²¿·ÖµÄ×Ö·û´®
&n ......
×òÌìÏÂÎç¿ìÏ°àµÄʱºò£¬ÎÞÒâÖÐÌýµ½¹«Ë¾Á½Î»Í¬ÊÂÔÚ̽ÌÖÅúÁ¿ÏòÊý¾Ý¿â²åÈëÊý¾ÝµÄÐÔÄÜÓÅ»¯ÎÊÌ⣬¶ÙʱÀ´ÁËÐËȤ£¬°Ñ×Ô¼ºµÄÏë·¨ÏòÁ½Î»Í¬ÊÂ˵ÁËһϣ¬ÓÚÊÇÓÐÁ˱¾ÎÄ¡£
¹«Ë¾¼¼Êõ±³¾°£ºÊý¾Ý¿â·ÃÎÊÀࣨxxx.DataBase.Dll£©µ÷Óô洢¹ý³ÌʵÏÖÊý¾Ý¿âµÄ·ÃÎÊ¡£
¼¼Êõ·½°¸Ò»£º
ѹËõʱ¼äϳÌÐòԱд³öµÄµÚÒ»¸ö°æ±¾£¬½ö½öΪÁËÍê³ÉÈÎÎñ£¬Ã»ÓдӳÌÐòÉÏ×öÈκÎÓÅ»¯£¬ÊµÏÖ·½Ê½ÊÇÀûÓÃÊý¾Ý¿â·ÃÎÊÀàµ÷Óô洢¹ý³Ì£¬ÀûÓÃÑ»·ÖðÌõ²åÈë¡£ºÜÃ÷ÏÔ£¬ÕâÖÖ·½Ê½Ð§Âʲ¢²»¸ß£¬ÓÚÊÇÓÐÁËÇ°ÃæµÄÁ½Î»Í¬ÊÂÌÖÂÛЧÂʵ͵ÄÎÊÌâ¡£
¼¼Êõ·½°¸¶þ£º
ÓÉÓÚÊÇ¿¼Âǵ½´óÊý¾ÝÁ¿µÄÅúÁ¿²åÈ룬ÓÚÊÇÎÒÏëµ½ÁËADO.NET2.0µÄÒ»¸öеÄÌØÐÔ£ºSqlBulkCopy¡£ÓйØÕâ¸öµÄÐÔÄÜ£¬ºÜÔç֮ǰÎÒÊÇÇ××Ô×ö¹ýÐÔÄܲâÊԵģ¬Ð§Âʷdz£¸ß¡£ÕâÒ²ÊÇÎÒÏò¹«Ë¾Í¬ÊÂÍƼöµÄ¼¼Êõ·½°¸¡£
¼¼Êõ·½°¸Èý£º
ÀûÓÃSQLServer2008µÄÐÂÌØÐÔ--±íÖµ²ÎÊý£¨Table-Valued Parameter£©¡£±íÖµ²ÎÊýÊÇSQLServer2008²ÅÓеÄÒ»¸öÐÂÌØÐÔ£¬Ê¹ÓÃÕâ¸öÐÂÌØÐÔ£¬ÎÒÃÇ¿ÉÒÔ°ÑÒ»¸ö±íÀàÐÍ×÷Ϊ²ÎÊý´«µÝµ½º¯Êý»ò´æ´¢¹ý³ÌÀï¡£²»¹ý£¬ËüÒ²ÓÐÒ»¸öÌص㣺±íÖµ²ÎÊýÔÚ²åÈëÊýÄ¿ÉÙÓÚ 1000 µÄÐÐʱ¾ßÓкܺõÄÖ´ÐÐÐÔÄÜ¡£
¼¼Êõ·½°¸ËÄ£º
¶ÔÓÚµ¥ÁÐ×ֶΣ¬¿ÉÒÔ°ÑÒª²åÈëµÄÊý¾Ý½øÐÐ×Ö·û´®Æ´½Ó£¬×îºóÔÙÔÚ´æ´¢¹ý³ÌÖвð·Ö³ÉÊý×飬ȻºóÖðÌ ......
ÔÚ¼ÆËã»úÖÐÊý¾ÝÓÐÁ½ÖÖÌØÕ÷£ºÀàÐͺͳ¤¶È¡£ËùνÊý¾ÝÀàÐ;ÍÊÇÒÔÊý¾ÝµÄ±íÏÖ·½Ê½ºÍ´æ´¢·½Ê½À´»®·ÖµÄÊý¾ÝµÄÖÖÀà¡£
ÔÚSQL Server ÖÐÿ¸ö±äÁ¿¡¢²ÎÊý¡¢±í´ïʽµÈ¶¼ÓÐÊý¾ÝÀàÐÍ¡£ÏµÍ³ÌṩµÄÊý¾ÝÀàÐÍ·ÖΪ¼¸´óÀ࣬Èç±í4-2 Ëùʾ¡£
ÆäÖУ¬BIGINT¡¢ SQL_VARIANT ºÍTABLE ÊÇSQL Server 2000 ÖÐÐÂÔö¼ÓµÄ3 ÖÖÊý¾ÝÀàÐÍ¡£ÏÂÃæ·ÖÀིÊö¸÷ÖÖÊý¾ÝÀàÐÍ¡£
Ò»¡¢ ÕûÊýÊý¾ÝÀàÐÍ
ÕûÊýÊý¾ÝÀàÐÍÊÇ×î³£ÓõÄÊý¾ÝÀàÐÍÖ®Ò»¡£
1¡¢INT £¨INTEGER£©
INT £¨»òINTEGER£©Êý¾ÝÀàÐÍ´æ´¢´Ó-2µÄ31´Î·½ £¨-2 £¬147 £¬483 £¬648£© µ½2µÄ31´Î·½-1 £¨2 £¬147 £¬483£¬647£© Ö®¼äµÄËùÓÐÕý¸ºÕûÊý¡£Ã¿¸öINT ÀàÐ͵ÄÊý¾Ý°´4 ¸ö×Ö½Ú´æ´¢£¬ÆäÖÐ1 λ±íʾÕûÊýÖµµÄÕý¸ººÅ£¬ÆäËü31 λ±íʾÕûÊýÖµµÄ³¤¶ÈºÍ´óС¡£
2¡¢SMALLINT
SMALLINT Êý¾ÝÀàÐÍ´æ´¢´Ó-2µÄ15´Î·½£¨ -32£¬ 768£© µ½2µÄ15´Î·½-1£¨ 32 £¬767 £©Ö®¼äµÄËùÓÐÕý¸ºÕûÊý¡£Ã¿¸öSMALLINT ÀàÐ͵ÄÊý¾ÝÕ¼ÓÃ2 ¸ö×ֽڵĴ洢¿Õ¼ä£¬ÆäÖÐ1 λ±íʾÕûÊýÖµµÄÕý¸ººÅ£¬ÆäËü15 λ±íʾÕûÊýÖµµÄ³¤¶ÈºÍ´óС¡£
3¡¢TINYINT ......