Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB
ÈÈÃűêÇ©£º c c# c++ asp asp.net linux php jsp java vb Python Ruby mysql sql access Sqlite sqlserver delphi javascript Oracle ajax wap mssql html css flash flex dreamweaver xml
 ×îÐÂÎÄÕ : sql

SQL Server¹ÜÀí³£ÓÃSQLÓï¾ä

1. ²é¿´Êý¾Ý¿âµÄ°æ±¾       
¡¡¡¡ select @@version
¡¡¡¡2. ²é¿´Êý¾Ý¿âËùÔÚ»úÆ÷²Ù×÷ϵͳ²ÎÊý       
¡¡¡¡exec master..xp_msver
¡¡¡¡3. ²é¿´Êý¾Ý¿âÆô¶¯µÄ²ÎÊý        
¡¡¡¡sp_configure
¡¡¡¡4. ²é¿´Êý¾Ý¿âÆô¶¯Ê±¼ä        
¡¡¡¡select convert(varchar(30),login_time,120) from master..sysprocesses where spid=1
¡¡¡¡²é¿´Êý¾Ý¿â·þÎñÆ÷ÃûºÍʵÀýÃû
¡¡¡¡print 'Server Name...............£º' + convert(varchar(30),@@SERVERNAME)        
¡¡¡¡print 'Instance..................£º' + convert(varchar(30),@@SERVICENAME)  
       
¡¡¡¡5. ²é¿´ËùÓÐÊý¾Ý¿âÃû³Æ¼°´óС    
¡¡¡¡sp_helpdb
¡¡¡¡ÖØÃüÃûÊý¾Ý¿âÓõÄSQL
¡¡¡¡sp_renamedb 'old_dbname', 'new_dbname'
¡¡¡¡6. ²é¿´ËùÓÐÊý¾Ý¿âÓû§µÇ¼ÐÅÏ¢    
¡¡¡¡sp_helplogins
¡¡¡¡²é¿´ËùÓÐÊý¾Ý¿âÓ ......

SQL ServerÖи÷¸öϵͳ±íµÄ×÷ÓÃ

 
sysaltfiles            Ö÷Êý¾Ý¿â              ±£´æÊý¾Ý¿âµÄÎļþ
syscharsets        Ö÷Êý¾Ý¿â               ×Ö·û¼¯ÓëÅÅÐò˳Ðò
sysconfigures     Ö÷Êý¾Ý¿â               ÅäÖÃÑ¡Ïî
syscurconfigs     Ö÷Êý¾Ý¿â               µ±Ç°ÅäÖÃÑ¡Ïî
sysdatabases    Ö÷Êý¾Ý¿â               ·þÎñÆ÷ÖеÄÊý¾Ý¿â
syslanguages    Ö÷Êý¾Ý¿â               ÓïÑÔ
syslogins         &n ......

SQL ServerµÄÁùÖÖÊý¾ÝÒƶ¯·½·¨

1.ͨ¹ý¹¤¾ßDTSµÄÉè¼ÆÆ÷½øÐе¼Èë»òµ¼³ö

¡¡¡¡DTSµÄÉè¼ÆÆ÷¹¦ÄÜÇ¿´ó£¬Ö§³Ö¶àÈÎÎñ£¬Ò²ÊÇ¿ÉÊÓ»¯½çÃ棬ÈÝÒײÙ×÷£¬µ«ÖªµÀµÄÈËÒ»°ã²»¶à£¬Èç¹ûÖ»ÊǽøÐÐSQL ServerÊý¾Ý¿âÖв¿·Ö±íµÄÒƶ¯£¬ÓÃÕâÖÖ·½·¨×îºÃ£¬µ±È»£¬Ò²¿ÉÒÔ½øÐÐÈ«²¿±íµÄÒƶ¯¡£ÔÚSQL Server Enterprise ManagerÖУ¬Õ¹¿ª·þÎñÆ÷×ó±ßµÄ+£¬Ñ¡ÔñÊý¾Ý¿â£¬ÓÒ»÷£¬Ñ¡ÔñAll tasks/Import Data...(»òAll tasks/Export Data...)£¬½øÈëÏòµ¼Ä£Ê½£¬°´Ìáʾһ²½Ò»²½×ß¾ÍÐÐÁË£¬ÀïÃæ·ÖµÃºÜϸ£¬¿ÉÒÔÁé»îµÄÔÚ²»Í¬Êý¾ÝÔ´Ö®¼ä¸´ÖÆÊý¾Ý£¬ºÜ·½±ãµÄ¡£¶øÇÒ¿ÉÒÔÁí´æ³ÉDTS°ü£¬Èç¹ûÒÔºó»¹ÓÐÏàͬµÄ¸´ÖÆÈÎÎñ£¬Ö±½ÓÔËÐÐDTS°ü¾ÍÐУ¬Ê¡Ê±Ê¡Á¦¡£Ò²¿ÉÒÔÖ±½Ó´ò¿ªDTSÉè¼ÆÆ÷£¬·½·¨ÊÇÕ¹¿ª·þÎñÆ÷Ãû³ÆÏÂÃæµÄData Transformation Services£¬Ñ¡Local Packages£¬ÔÚÓұߵĴ°¿ÚÖÐÓÒ»÷£¬Ñ¡New Package£¬¾Í´ò¿ªÁËDTSÉè¼ÆÆ÷¡£ÖµµÃ×¢ÒâµÄÊÇ£ºÈç¹ûÔ´Êý¾Ý¿âÒª¿½±´µÄ±íÓÐÍâ¼ü£¬×¢ÒâÒƶ¯µÄ˳Ðò£¬ÓÐʱҪ·ÖÅúÒƶ¯£¬·ñÔòÍâ¼üÖ÷¼ü£¬Ë÷Òý¿ÉÄܶªÊ§£¬Òƶ¯µÄʱºòÑ¡ÏîÅԱߵÄÌáʾ˵µÄºÜÃ÷°×£¬»òÕßÒ»´ÎÐԵĸ´ÖƵ½Ä¿±êÊý¾Ý¿âÖУ¬ÔÙÖØн¨Á¢Íâ¼ü£¬Ö÷¼ü£¬Ë÷Òý¡£
¡¡¡¡Æäʵ½¨Á¢Êý¾Ý¿âʱ£¬½¨Á¢Íâ¼ü£¬Ö÷¼ü£¬Ë÷ÒýµÄÎļþÓ¦¸ÃºÍ½¨±íÎļþ·Ö¿ª£¬¶øÇÒÓõÄÊý¾ÝÎļþÒ²·Ö¿ª£¬²¢·Ö±ð·ÅÔÚ²»Í¬µÄÇý¶¯Æ÷ÉÏ£¬ÓÐÀûÓÚÊ ......

SQLʱ¼ä¶Î²éѯ


SQLʱ¼ä¶Î²éѯ
ACCESSµÄ»°
select * from table where date1<#2008-1-20# and date2>#2007-8-30#
MYSQLµÄ»°
select * from table where date1<'2008-1-20' and date2>'2007-3-30'
Ò²¿ÉÒÔ
select * from table where date1 between '2008-1-20' and '2007-3-30'
ÆäÖÐdate1,date2¶¼ÊÇÈÕÆÚÀàÐ͵Ä×Ö¶Î
sQLʱ¼äÐͲéѯÓï¾ä
2007Äê12ÔÂ04ÈÕ ÐÇÆÚ¶þ 13:54
select * from jy_jjgl a ,jy_jygl b where convert(varchar(10),a.shtime,120)='2007-11-27'
1.ÏÔʾ±¾ÔµÚÒ»Ìì
SELECT DATEADD(mm,DATEDIFF(mm,0,getdate()),0)
select convert(datetime,convert(varchar(8),getdate(),
120)+'01',120)
2.ÏÔʾ±¾ÔÂ×îºóÒ»Ìì
select dateadd(day,-1,convert(datetime,convert
(varchar(8),dateadd(month,1,getdate()),120)+'01',120))
SELECT dateadd(ms,-3,DATEADD(mm,DATEDIFF(m,0,getdate())+1,0))
3.ÉϸöÔµÄ×îºóÒ»Ìì
SELECT dateadd(ms,-3,DATEADD(mm,DATEDIFF(mm,0,getdate()),0))
4.±¾ÔµĵÚÒ»¸öÐÇÆÚÒ»i
select DATEADD(wk,DATEDIFF(wk,0, dateadd(dd,6-datepart(
day,getdate()),getdate())),0)
5.±¾ÄêµÄµÚÒ»Ìì
SELECT DATEADD(yy,DATEDIF ......

Éí·ÝÖ¤ÑéÖ¤Ëã·¨(SQL°æ)

Éí·ÝÖ¤ÑéÖ¤Ëã·¨(SQL°æ)
/**//*
ÑéÖ¤Éí·ÝÖ¤Ëã·¨
By:Áõ־ΰ
2008-1-29ÓëÌì½ò
*/
CREATE FUNCTION [fn_ValidateIDC]
(
@idc varchar(18)
)RETURNS BIT
AS
BEGIN
IF LEN(@idc)<>15 AND LEN(@idc)<>18--Éí·ÝÖ¤ºÅÖ»ÓÐ15»ò18λ
RETURN(0)
IF LEN(@idc)=15  --Èç¹ûÊÇ15λÉí·ÝÖ¤ ÔòÖ»ÑéÖ¤ÈÕÆÚºÍÊÇ·ñÊý×Ö¸ñʽ
   IF ISDATE('19'+SUBSTRING(@idc,7,6))=0 OR ISNUMERIC(@idc)=0
       RETURN(0)
    ELSE
       RETURN(1)
/**//**//**//*
18λÉí·ÝÖ¤ ÑéÖ¤ÈÕÆÚ Ð£Ñéλ
*/
IF ISDATE(SUBSTRING(@idc,7,8))=0 OR ISNUMERIC(SUBSTRING(@idc,1,17))=0--ÑéÖ¤ÈÕÆÚºÍÇ°17λÊÇ·ñÊý×Ö¸ñʽ
   RETURN(0)
/**//**//**//*Ñé֤УÑéλ¿ªÊ¼*/
DECLARE @validFactors VARCHAR(17),@validCodes VARCHAR(11),@i TINYINT,@iTemp INT
SELECT @validFactors='79A584216379A5842',@validCodes='10X98765432',@i=1,@iTemp=0
WHILE @i<18
   BEGIN
      SELECT @iTemp=@iTemp+CAST(SUBSTRING(@idc,@i,1) AS INT)*(CASE ......

SQLºº×Öת»»Æ´Òô

/*
¸ù¾Ýºº×Ö»ñÈ¡È«Æ´
1.Éú³ÉËùÓжÁÒôÁÙʱ±í
2.¸ù¾ÝChinese_PRC_CS_AS_KS_WS ÅÅÐò»ñÈ¡¶ÁÒô
*/
Create function ChineseSpell(@str varchar(100))
returns varchar(8000)
as
begin
declare @re varchar(8000)
--Éú³ÉÁÙʱ±í
declare @t table(chr nchar(1) collate Chinese_PRC_CS_AS_KS_WS,py nvarchar(20))
insert into @t select'ß¹','a'
insert into @t select'厑','aes'
insert into @t select'°¥','ai'
insert into @t select'°²','an'
insert into @t select'°¹','ang'
insert into @t select'°¼','ao'
insert into @t select'°Ë','ba'
insert into @t select'挀','bai'
insert into @t select'兡','baike'
insert into @t select'瓸','baiwa'
insert into @t select'°â','ban'
insert into @t select'°î','bang'
insert into @t select'Ùè','bao'
insert into @t select'萡','be'
insert into @t select'Úé','bei'
insert into @t select'±¼','ben'
insert into @t select'伻','beng'
insert into @t select'皀','bi'
insert into @t select'±ß','bian'
insert into @t s ......
×ܼǼÊý:4346; ×ÜÒ³Êý:725; ÿҳ6 Ìõ; Ê×Ò³ ÉÏÒ»Ò³ [716] [717] [718] [719] [720] 721 [722] [723] [724] [725]  ÏÂÒ»Ò³ βҳ
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ