Êý¾Ý×ֵ䣨SQLÓï¾ä£©
declare @tmp table
(
id int identity(1,1),
TableName varchar(100),
Column_name varchar(100),
Type varchar(50),
Lenght int,
Scale int,
Nullable varchar(1),
Defaults varchar(4000),
PrimaryKey varchar(1)
)
select iid = identity(int,1,1), * into #a from SysObjects where xtype = 'U'
declare @i int
declare @max int
declare @table varchar(100)
set @i = 1
select @max = max(iid) from #a
while @i <= @max
begin
select @table = name from #a where iid = @i
if @@rowcount > 0
begin
insert @tmp (TableName, Column_name, Type, Lenght, Scale, Nullable, Defaults,PrimaryKey)
select @table, a.name, c.name, a.length, a.xscale, case a.isnullable when 0 then 'N' else 'Y' end, isnull(d.text,''), case when x.PrimaryKey is null then '' else x.PrimaryKey end
from SysColumns a with(nolock)
inner join (select * from SysObjects with(nolock) where xtype = 'U' and id = object_id(@table)) b on a.id = b.id
inner join SysTypes c with(nolock) on a.xtype = c.xusertype
left join syscomments d with(nolock) on a.cdefault = d.id
left join
(select f.id, colid, 'Y' as PrimaryKey from SysIndexKeys f with(nolock), SysIndexes e, SysObjects g
where f.id = e.id and f.indid = e.indid and f.id = g.parent_obj and e.name = g.name
and g.xtype = 'PK' and g. parent_obj = object_id(@table)) x on a.id = x.id and a.colid = x.colid
end
set @i = @i + 1
end
select * from @tmp
Ïà¹ØÎĵµ£º
ÈýÖÖSQL·ÖÒ³·¨
±íÖÐÖ÷¼ü±ØÐëΪ±êʶÁУ¬[ID] int IDENTITY (1,1)
1.·ÖÒ³·½°¸Ò»£º(ÀûÓÃNot InºÍSELECT TOP·ÖÒ³)
Óï¾äÐÎʽ£º
SELECT TOP 10 *
from TestTable
WHERE (ID NOT IN
(SELECT TOP 20 id
  ......
Sql Server ÖжÔÓÚʱ¼ä×ֶεĸñʽ»¯º¯ÊýÖ§³Ö¾Í²»¼°OracleµÄ·½±ã£¬ÏÂÃæÁгöSql ServerÖг£ÓõÄʱ¼ä¸ñʽ»¯º¯Êý¡£ÆäÖГGETDATE()”ΪSql ServerµÄϵͳʱ¼äº¯Êý£¬´Ë´¦Ö»×öÑÝʾÓá£
Select CONVERT(varchar(100), , 0): 05 16 2006 10:57AM
Select CONVERT(varchar(100), GETDATE(), 1): 05/16/06
Select CONVERT( ......
SQLÊý¾Ý¿âÐÞ¸´ÃüÁî
2007-12-23 16:49
MS Sql Server ÌṩÁ˺ܶàÊý¾Ý¿âÐÞ¸´µÄÃüÁµ±Êý¾Ý¿âÖÊÒÉ»òÊÇÓеÄÎÞ·¨Íê³É¶Áȡʱ¿ÉÒÔ³¢ÊÔÕâЩÐÞ¸´ÃüÁî¡£
1. DBCC CHECKDB
ÖØÆô·þÎñÆ÷ºó£¬ÔÚûÓнøÐÐÈκβÙ×÷µÄÇé¿öÏ£¬ÔÚSQL²éѯ·ÖÎöÆ÷ÖÐÖ´ÐÐÒÔÏÂSQL½øÐÐÊý¾Ý¿âµÄÐÞ¸´£¬ÐÞ¸´Êý¾Ý¿â´æÔÚµÄÒ»ÖÂÐÔ´íÎóÓë·ÖÅä´íÎó¡£
use master
decla ......
Á˽âLDAP
LDAPÊÇLight Directory Access ProtocolÇáÁ¿¼¶Ä¿Â¼·ÃÎÊÐÒéµÄ¼ò³Æ£¬LDAPÓëÊý¾Ý¿âÓкܴóµÄÇø±ð£¬ËüµÄÊý¾ÝÊÇÊ÷×´µÄ£¬¶øÇÒÿ¸ö½ÚµãµÄÊôÐÔÒ²±È½Ï¹Ì¶¨¡£
LDAPÐÒéÖÐÓÃdn±íʾһÌõ¼Ç¼µÄλÖã¬dc±íʾһÌõ¼Ç¼ËùÊôÇøÓò£¬ou±íʾһÌõ¼Ç¼ËùÊô×éÖ¯£¬cn±íʾһÌõ¼Ç¼µÄÃû³Æ£¬uid±íʾһÌõ¼Ç¼µÄID£¬ÆäÖÐdnÊǸù¾ ......
---------Êýѧº¯Êý ---------------
¡¡¡¡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 ......