ÓÃADO¹ÜÀíSQL SERVER
ÓÃADO¹ÜÀíSQL SERVER
http://blog.csdn.net/cncco/archive/2009/11/09/4789123.aspx
ÔÚÈí¼þ¿ª·¢ÖУ¬³£³£ÐèҪΪ³ÌÐò½¨Á¢Sql ServerÊý¾Ý¿âµÄÔËÐл·¾³¡£Íê³ÉÈçÔÚSQL ServerÊý¾Ý¿âÖн¨Á¢É豸£¬½¨Á¢Êý¾Ý¿â£¬½¨Á¢±í¸ñ£¬·ÖÅäȨÏ޵ȹ¦ÄÜ£¬ÈçºÎ·½±ãµÄ½¨Á¢Ó¦ÓóÌÐòËùÐèSql Server»·¾³µÄÊý¾Ý¿â»·¾³£¬¶ø²»ÓÃÆô¶¯SQL Enterprise ManagerÄØ£¿
ÏÂÃæÀ´¿´£º
¡¡¡¡Æô¶¯VB6.0£¬Ð½¨Ò»¸ö¹¤³Ì,Ôڲ˵¥-¹¤³Ì-ÒýÓÃÀïÑ¡"Microsoft ActiveX Data Objects 2.0 Library",´úÂëÀïÐèÒªÓÐ
dim conn As New ADODB.Connection ‘¶¨ÒåADOÊý¾Ý¿â¶ÔÏó
conn.ConnectionString = "driver={SQL Server};" & "server=" & ServerName & ";uid=" & UserName & ";
pwd=" & Password & ";database=" & DatabaseName & "" ’Á¬½ÓÊý¾Ý´®
conn.open ‘Á¬½ÓÊý¾Ý¿â
¡¡¡¡ ×¢£ºServerNameΪ·þÎñÆ÷Ãû£»UserNameΪÓû§Ãû£»PasswordΪÓû§¿ÚÁ DatabaseNameÒªµÇ¼µÄÊý¾Ý¿âÃû£¬¿ÉÒÔΪ¿Õ¡£
¡¡¡¡ ºËÐÄ´úÂëÈçÏ£º
Ò»¡¢½¨Á¢Êý¾Ý¿â
¡¡¡¡ ÔÀí£º½¨Á¢Êý¾Ý¿âÏÈÒª³õʼ»¯Ò»¸öÊý¾Ý¿âÉ豸£¬È»ºóÔÚ´ËÉ豸ÉϽ¨Á¢Êý¾Ý¿â¡£ËùÓеÄÉ豸ÃûÔÚϵͳ±í"sysdevices"ÀïÓмǼ£¬ËùÓеÄÊý¾Ý¿âÃûÔÚϵͳ±í"sysdatabases"ÀïÓмǼ¡£ÔÚ½¨Á¢Ö®Ç°£¬×îºÃÏȲéѯÕâÁ½¸öϵͳ±í£¬¿´Ãû³ÆÊÇ·ñÒѾ´æÔÚ¡£ÔÚ½¨Á¢É豸֮ǰ£¬»¹ÐèÒªµÄÒ»¸öÎïÀíÃûºÍ¿ÕÏеÄÉ豸±êʶºÅ¡£
³õʼ»¯É豸Óï·¨£º
DISK INIT NAME="device_name",PHYNAME="physical_name",VDEVNO=device_number,SIZE=numberofblock
¡¡¡¡ ˵Ã÷£ºÕâÀNAMEÊÇÊý¾Ý¿âÉ豸Ãû£¨Ò»¸öÓÐЧµÄ±êʶ·û£©£¬PHYNAME(Êý¾Ý¿âÉ豸µÄÎïÀíÃû)ÊÇÔʼµÄ´ÅÅÌ·ÖÇøUNIX»òÍâÉ裨vms£©Ãû£¬»òÕßÊDzÙ×÷ϵͳµÄÎļþÃû¡£VDEVNOʱÊý¾Ý¿âµÄÉ豸±êʶºÅ£¬ºÏ·¨ÖµÎª1-255£¬SIZEµÄµ¥Î»ÊÇ2KBµÄ¿é£¬ÀýÈç1MB£¨1024KB£©Ê±SIZEֵΪ512¡£
¡¡¡¡ ½¨Á¢Êý¾Ý¿âÓï·¨£ºCREATE DATABASE database_name [ON database_device]
¡¡¡¡ ˵Ã÷£ºdatabase_nameÊÇÒª½¨µÄÊý¾Ý¿âÃû£¬database_deviceÊÇÉ豸Ãû
¡¡¡¡ Ҫн¨Á¢Ò»¸öÊý¾Ý¿â£¬¾ÍÐèÒªÉ豸Ãû£¬Êý¾Ý¿âÃû£¬ÎïÀíÃûºÍÉ豸ºÅ¡£¾ßÌå²½ÖèÈçÏ£º
¡¡¡¡ ÎÒÃǼÙÉèÓû§ÒªÐ½¨Á¢É豸dbName£¬ÔÚÉ豸dbNameÉϽ¨Á¢Êý¾Ý¿âdbName¡£
¡¡¡¡ 1£©µÃµ½É豸Ãû bNameÊÇÓû§¸ø³öµÄÉ豸Ãû£»ÏȲéѯϵͳ±ísysdevices£¬¿´Óû§¸ø³öµÄÉ豸ÃûdbNameÊÇ·ñÒѾ´æÔÚ£¬Èç¹û´ËÉ豸Ãû´æÔÚ£¬¾ÍÐèÒª¸ü»»Ò»¸öÉ豸Ãû£¬ÒòΪÉ豸ÃûÊÇΨһµÄ¡£
sql = "select * from sysdevices
Ïà¹ØÎĵµ£º
ÒÔÏÂÊÇÒ»¸ö²éѯIPµØÖ·¹éÊôµØµÄCLR´æ´¢¹ý³Ì£¬Èý²½£º
1¡¢ÓÃC#À´×öDLL£¬´úÂëÈçÏ£º
//====================================================================
using System;
using System.Collections.Generic;
using System.Text;
using System.Data.SqlTypes;
using System.Data.SqlClient;
using Microsoft.Sq ......
Oracleµ÷ÕûÓëSQL Óï¾äµÄµ÷ÓŵĹØϵ
ÔÚOracleµ÷ÕûÖÐÎÒÃÇ»¹»áÉæ¼°µ½SQL Óï¾äµÄµ÷ÓÅ£¬ÎÒÃǽÓÏÂÀ´¾ÍÀ´¿´ÒÔÏ嵀 SQL Óï¾äµÄµ÷ÓÅ¡£ÎÒÃǶ¼ÖªµÀ Oracle ÖÐµÄ SQL µ÷ÓÅÊÇÒ»¸öÏ൱¸´ÔÓµÄÖ÷Ì⣬ÉõÖÁÊÇÐèÒªÕû±¾ÊéÀ´½éÉÜ Oracle SQL µ÷ÓŵÄϸ΢²î±ð¡£
²»¹ýÓÐһЩ»ù±¾µÄ¹æÔòÊÇÿ¸ö Oracle DBA ¶¼ÐèÒª¸ú´ÓµÄ£¬ÕâЩ¹æÔò¿ÉÒÔ¸ÄÉÆËûÃÇϵͳµÄ ......
1.Ò»¸öÔµÚÒ»ÌìµÄ
Select DATEADD(mm, DATEDIFF(mm,0,getdate()), 0)
2.±¾ÖܵÄÐÇÆÚÒ»
Select DATEADD(wk, DATEDIFF(wk,0,getdate()), 0)
3.Ò»ÄêµÄµÚÒ»Ìì
Select DATEADD(yy, DATEDIFF(yy,0,getdate()), 0)
4.¼¾¶ÈµÄµÚÒ»Ìì
Select DATEADD(qq, DATEDIFF(qq,0,getdate()), 0)
5.µ±ÌìµÄ°ëÒ¹
Select DATEADD(dd, DAT ......
SQL ServerÖм¸ÖÖ·ÖÒ³µÄsqlÓï¾ä
·½·¨1£º
ÊÊÓÃÓÚ SQL Server 2000/2005
SELECT TOP Ò³´óС *
from table1
WHERE id NOT IN
(
SELECT TOP Ò ......