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

sql ÈÕÆÚת»»

Select  
CONVERT(varchar, getdate(), 1),--mm/dd/yy  
CONVERT(varchar, getdate(), 2),--yy.mm.dd  
CONVERT(varchar, getdate(), 3),--dd/mm/yy  
CONVERT(varchar, getdate(), 4),--dd.mm.yy  
CONVERT(varchar, getdate(), 5),--dd-mm-yy  
CONVERT(varchar, getdate(), 10),--mm-dd-yy  
CONVERT(varchar, getdate(), 11),--yy/mm/dd  
CONVERT(varchar, getdate(), 12),--yymmdd 
 ----´øÊÀ¼ÍºÅ 
select convert(varchar(10),getdate(),100) --06 15 2007 »ò0 
select convert(varchar(10),getdate(),102) --2007.06.15 
select convert(varchar(10),getdate(),103) --15/06/2007 
select convert(varchar(10),getdate(),104) --15.06.2007 
select convert(varchar(10),getdate(),105) --15-06-2007 
select convert(varchar(10),getdate(),106) --15 06 2007 
select convert(varchar(10),getdate(),107) --06-15,200 
select convert(varchar(10),getdate(),108) --10:06:46 µ±Ç°Ê±¼ä 
select convert(varchar(10),getdate(),109) --06 15 2007 »òÕß9 
select convert(varchar(10),getdate(),110) --06-15-2007 
select convert(varchar(10),getdate(),111) --2007/06/15 
select convert(varchar(10),getdate(),112) --20070615select convert(varchar(10),getdate(),113) --15 06 2007 »òÕß13 
select convert(varchar(10),getdate(),114) --10:10:37:0 
select convert(varchar(10),getdate(),120) --2007-06-15 »ò20 
select convert(varchar(30),getdate(),121) --2007-06-15 10:11:45.040 »ò21 
select convert(varchar(30),getdate(),126) --2007-06-15T10:12:44:603s 
elect convert(varchar(50),getdate(),127) --2007-06-15T10:14:35:433 ˵´øÊ±Çø 
select convert(varchar(40),getdate(),130) --»ØÀúdd mon yyyy hh:mi:ss:mmmAM 
select convert(varchar(30),getdate(),131) --30/05/1428 10:17:19:470AM
12Сʱת»»³É24Сʱ
select dateadd(hh,24,getdate())
xml Êý¾ÝµÄת»»
convert(datetime, x.item.value('SaleCEOCheckDate[1]','DateTime'),120) AS SaleCEOCheckDate,


Ïà¹ØÎĵµ£º

×ÔÔö×ֶεÄSQLÓï¾ä½â¾ö·½°¸

create table [±íÃû]
(
[×Ô¶¯±àºÅ×Ö¶Î] int IDENTITY (1,1) PRIMARY KEY ,
[×Ö¶Î1] nVarChar(50) default 'ĬÈÏÖµ' null ,
[×Ö¶Î2] ntext null ,
[×Ö¶Î3] datetime,
[×Ö¶Î4] money null ,
[×Ö¶Î5] int default 0,
[×Ö¶Î6] Decimal (12,4) default 0,
[×Ö¶Î7] image null ,
)
ɾ³ý±í£º
Drop table [ ......

SQL Server ѹËõÈÕÖ¾¿Õ¼ä

ʹÓÃÁËÒ»¶Îʱ¼äºó£¬SQL Server µÄ LDFÎļþÌå»ý¾Þ´ó.
ÈçºÎ´¦ÀíàÏ, ¶ÔÓÚ SQL Server 2005 ¼°Ö®Ç°µÄ°æ±¾£¬¿ÉÒÔʹÓÃÈçÏ SQL£º
declare @name varchar(50)
set @name='dbname
'
backup
log @name
with truncate_only
dbcc shrinkdatabase (@name,20)
¿ÉÊÇÔÚ SQL Server 2008 ¿ªÊ¼£¬Ö´ÐÐÉÏÃæµÄÓï¾ä»á±¨´í:
'truncate ......

sql ¿ç·þÎñÆ÷ ²éѯ

--´´½¨Á´½Ó·þÎñÆ÷
exec sp_addlinkedserver   'ITSV ', ' ', 'SQLOLEDB ', 'Ô¶³Ì·þÎñÆ÷Ãû»òipµØÖ· '
exec sp_addlinkedsrvlogin 'ITSV ', 'false ',null, 'Óû§Ãû ', 'ÃÜÂë '
--²éѯʾÀý
select * from ITSV.Êý¾Ý¿âÃû.dbo.±íÃû
--µ¼ÈëʾÀý
select * into ±í from ITSV.Êý¾Ý¿âÃû.dbo.±íÃû
--ÒÔºó²»Ô ......

sql ×óÁ¬½Ó ½âÊÍ

Á¬½Ó²éѯ£¬¾ÍÊǽ«
Á½¸ö»ò¶à¸ö
±í»òÊÓͼ
ͨ¹ýÒ»¶¨µÄÌõ¼þ
½«È«²¿»ò²¿·Ý×Ö¶Î
È«²¿»ò²¿·Ý¼Ç¼
Á¬½Óµ½Ò»Æð£¬µÃµ½Ò»¸öеÄÊý¾Ý¼¯ºÏ¡£
È磺ÓÐÈËÔ±µµ°¸ºÍ¹¤×ʵµ°¸Á½¸ö±í£¬Á½¸ö±íÓй²Í¬µÄ¹Ø¼ü×Ö¶ÎXMDM(ÐÕÃû´úÂ룩£¬ÆäÖÐÈËÔ±µµ°¸´æ´¢ÁËÈËÊÂ×ÊÁÏ£¬¹¤×ʵµ°¸´æ´¢ÁËн³ê×ÊÁÏ¡£
Òò´Ë¿ÉÒÔͨ¹ýXMDM×ֶν«Á½¸ö±íÁ¬½ÓÆðÀ´£¬´Ó¶øÊ¹²éѯ½ ......

SQL Server 2005´æ´¢¹ý³Ì¿ª·¢µÄÒ»µã¾­Ñé

1¡¢  ´æ´¢¹ý³Ì
1£©  ¾¡Á¿½«´úÂë¶Î·Åµ½TRY…CATCH…¡£
µ«·²Ê¹ÓÃC#д¹ý´úÂëµÄÈË£¬¶¼ÖªµÀC#ÖÐTRY…CATCH…µÄÔËÐкͳö´íÌø×ªÂß¼­£¬¶øSQL Server2005ÖУ¬ÆäÔËÐкͳö´íÌø×ªÂß¼­ÓëÔÚC#ÖÐÊÇÒ»Öµġ£TRY…CATCH…ÊÇSQL Server2005ÖÐÐÂÔöµÄ£¬¹¦ÄÜÇ¿´ó£¬ÇҺܺÃÓá£
2£©&nb ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ