Ò»Ö»²éѯSQLServer 2005ËùÓÐÐÅÏ¢µÄÓï¾ä
select
table_name=
(
case when t_c.column_id=1
then t_o.name
else ''
end
),
column_id=t_c.column_id,
column_name=t_c.name,
type=t.name,
max_length=t_c.max_length,
precision=isnull(t_c.precision,0),
scale=isnull(t_c.scale,0),
is_identity=case when t_c.is_identity=1 then '√' else '' end,
is_primary=
(
case when exists
(
select 1 from sys.indexes i,sys.index_columns ic,sys.objects o
where o.type='PK' and o.name=i.name and i.index_id=ic.index_id
and i.object_id=ic.object_id and ic.column_id=t_c.column_id
and o.parent_object_id=t_c.object_id
)
then '√'
else ''
end
),
is_nullable=case when t_c.is_nullable=1 then '√' else '' end,
default_value=isnull(c.definition,''),
description=isnull(e.value,''),
fk_column_name=isnull(f_c.name,''),
fk_table_name=isnull(f_o.name,'')
from sys.columns t_c
Ïà¹ØÎĵµ£º
È«ÎļìË÷ÊǶԴóÊý¾ÝÎı¾½øÐÐË÷Òý£¬ÔÚ½¨Á¢µÄË÷ÒýÖжÔÒª²éÕҵĵ¥´Ê½øÐнøÐÐËÑË÷£¬¶¨Î»ÄÄЩÎı¾Êý¾Ý°üÀ¨ÒªËÑË÷µÄµ¥´Ê¡£Òò´Ë£¬È«ÎļìË÷µÄÈ«²¿¹¤×÷¾ÍÊǽ¨Á¢Ë÷ÒýºÍÔÚË÷ÒýÖÐËÑË÷¶¨Î»£¬ËùÓеŤ×÷¶¼ÊÇΧÈÆÕâÁ½¸öÀ´½øÐеġ£ÏÂÃæ¾ÍÖð¸ö½éÉÜ¡£
¡¡¡¡½¨Á¢È«ÎÄË÷ÒýÖÐÓÐÁ½Ïî·Ç³£ÖØÒª£¬Ò»¸öÊÇÈçºÎ¶ÔÎı¾½øÐзִʣ¬Ò»Êǽ¨Á¢Ë÷ÒýµÄÊý¾Ý½á¹¹¡ ......
΢ÈíµÄSQL SERVERÌṩÁËÁ½ÖÖË÷Òý£º¾Û¼¯Ë÷Òý(clustered index£¬Ò²³Æ¾ÛÀàË÷Òý¡¢´Ø¼¯Ë÷Òý)ºÍ·Ç¾Û¼¯Ë÷Òý(nonclustered index£¬Ò²³Æ·Ç¾ÛÀàË÷Òý¡¢·Ç´Ø¼¯Ë÷Òý)……
(Ò»)ÉîÈëdz³öÀí½âË÷Òý½á¹¹
ʵ¼ÊÉÏ£¬Äú¿ÉÒÔ°ÑË÷ÒýÀí½âΪһÖÖÌØÊâµÄĿ¼¡£Î¢ÈíµÄSQL SERVERÌṩÁËÁ½ÖÖË÷Òý£º¾Û¼¯Ë÷Òý(clustered index£¬Ò²³Æ¾ÛÀàË÷Òý¡¢´ ......
Ê×ÏȲå¾äÌâÍâ»°£º´´½¨Ò»¸ö×ÔÈ»Êý±íNums¡£ÕâÊÇ¡¶SQL Server 2005¼¼ÊõÄÚÄ»£ºT-SQL²éѯ¡·Ò»ÊéµÄ½¨Òé¡£
ÔÚSQL Server 2005ÖУ¬¿ÉÒÔ½èÓÃROW_NUMBERÅÅÃûº¯ÊýÇáËÉÉú³ÉÎÒÃÇËùÐèµÄ×ÔÈ»Êý±í£º
--×ÔÈ»Êý±í1-1M
CREATE TABLE Nums(n int NOT NULL PRIMARY KEY CLUSTERED)
WITH B1 AS(SELECT n=1 UNION ALL SELECT n=1), --2
B2 AS( ......
±¾ÎÄת×Ô£ºhttp://blog.csdn.net/jinjazz/archive/2008/07/14/2650506.aspx
½«oledb¶ÁÈ¡µÄexcelÊý¾Ý¿ìËÙ²åÈëµÄsqlserverÖУ¬ºÜ¶àÈËͨ¹ýÑ»·À´Æ´½Ósql£¬ÕâÑù×ö²»µ«ÈÝÒ׳ö´í¶øÇÒЧÂʵÍÏ£¬×îºÃµÄ°ì·¨ÊÇʹÓÃbcp£¬Ò²¾ÍÊÇSystem.Data.SqlClient.SqlBulkCopy ÀàÀ´ÊµÏÖ¡£²»µ«Ëٶȿ죬¶øÇÒ´úÂë¼òµ¥£¬ÏÂÃæ²âÊÔ´ú ......
SQLserverÖÐÓÃconvertº¯Êýת»»ÈÕÆÚ¸ñʽ
2008-01-23 15:47
SQLserverÖÐÓÃconvertº¯Êýת»»ÈÕÆÚ¸ñʽ2008-01-15 15:51SQLserverÖÐÓÃconvertº¯Êýת»»ÈÕÆÚ¸ñʽ
SQL ServerÖÐÎÄ°æµÄĬÈϵÄÈÕÆÚ×Ö¶Îdatetime¸ñʽÊÇyyyy-mm-dd Thh:mm:ss.mmm
ÀýÈç:
select getdate()
2004-09-12 11:06:08.177
ÕûÀíÁËÒ»ÏÂSQL ServerÀïÃæ¿ÉÄÜ ......