Sql Server Éú³ÉÊý¾Ý×Öµä
use Dbname
go
select
[±íÃû]=c.Name,
[±í˵Ã÷]=isnull(f.[value],''),
[ÁÐÃû]=a.Name,
[ÁÐÐò號]=a.Column_id,
[±êʶ]=case when is_identity=1 then '√' else '' end,
[Ö÷鍵]=case when exists(select 1 from sys.objects x join sys.indexes y on x.Type=N'PK' and x.Name=y.Name
join sysindexkeys z on z.ID=a.Object_id and z.indid=y.index_id and z.Colid=a.Column_id)
then '√' else '' end,
[ÀàÐÍ]=b.Name,
[×Ö½ÚÊý]=case when a.[max_length]=-1 and b.Name!='xml' then 'max/2G'
when b.Name='xml' then '2^31-1×Ö節/2G'
else rtrim(a.[max_length]) end,
[³¤¶È]=case when ColumnProperty(a.object_id,a.Name,'Precision')=-1 then '2^31-1'
else rtrim(ColumnProperty(a.object_id,a.Name,'Precision')) end,
[СÊý]=isnull(ColumnProperty(a.object_id,a.Name,'Scale'),0),
[ÊÇ·ñΪ¿Õ]=case when a.is_nullable=1 then '√' else '' end,
[ÁÐ˵Ã÷]=isnull(e.[value],''),
[ĬÈÏÖµ]=isnull(d.text,'')
from
sys.columns a &
Ïà¹ØÎĵµ£º
ʹÓÃSQL Serverµ¼Èë/µ¼³öExcel,°üº¬²¿·Ö´íÎóÐÅÏ¢´¦Àí·½·¨;
²Ù×÷ÊÖ¼Ç,Áô´Ë±¸²é
/*
µ¼Èë
*/
--´íÎóÐÅÏ¢ÈçÏÂʱ£º
--Msg 15281, Level 16, State 1, Line 2
--SQL Server blocked access to STATEMENT 'OpenRowset/OpenDatasource' of component 'Ad Hoc Distributed Queries' because this component is turned off as ......
ʹÓÃSQL ServerÉí·ÝÑéÖ¤µÇ¼ʱ±¨´í£º
ÎÞ·¨Á¬½Óµ½.\SQLEXPRESS.
Additional information:
Óû§'sa'µÇ¼ʧ°Ü¡£¸ÃÓû§Óë¿ÉÐÅSQL Server Á¬½ÓÎÞ¹ØÁª¡£(microsoft SQL Server,Error:18452£©)
------------------
ÏÂÃæÊÇÓ³Éäʱ±¨µÄ´í£º
´´½¨¶ÔÓÚÓû§“sa”ʧ°Ü¡££¨microsoft.sqlServer.express.smo£©
Additional ......
ǰÑÔ
±¾ÎĵµÖ÷Òª½éÉÜÓëSQLµ÷ÕûÓйصÄÄÚÈÝ£¬ÄÚÈÝÉæ¼°¶à¸ö·½Ã棺SQLÓï¾äÖ´ÐеĹý³Ì¡¢ORACLEÓÅ»¯Æ÷£¬±íÖ®¼äµÄ¹ØÁª£¬ÈçºÎµÃµ½SQLÖ´Ðмƻ®£¬ÈçºÎ·Ö ÎöÖ´Ðмƻ®µÈÄÚÈÝ£¬´Ó¶øÓÉdzµ½ÉîµÄ·½Ê½Á˽âSQLÓÅ»¯µÄ¹ý³Ì£¬Ê¹´ó¼ÒÖð²½²½ÈëSQLµ÷ÕûÖ®ÃÅ£¬È»ºóÄ㽫·¢ÏÖ……¡£
&nb ......
SQLº¯Êý
ÔÚSQLÖУ¬º¯Êý¶ÔÊý¾Ý»òÊý¾Ý×éÖ´ÐвÙ×÷£¬È»ºó·µ»ØÐèÒªµÄÖµ¡£º¯Êý±í´ïʽ¿ÉÒÔ³öÏÖÔÚSELECTÁбíÖУ¬»òÕß
ÔÚÈκÎÔÊÐí³öÏÖµÄλÖÃÉÏ¡£SQL°üº¬ÁËÆßÖÖº¯Êý:
(1)¾ÛºÏº¯Êý:·µ»Ø»ã×ÜÖµ¡£
(2)תÐͺ¯Êý:½«Ò»ÖÖÊý¾ÝÀàÐÍת»»ÎªÁíÍâÒ»ÖÖ¡£
(3)ÈÕÆÚº¯Êý:´¦ÀíÈÕÆÚºÍʱ¼ä¡£
(4)Êýѧº¯Êý:Ö´ÐÐËãÊõÔËËã¡£
(5)×Ö·û´®º¯Êý:¶Ô×Ö·û´ ......
ÄãÊÇ·ñÓöµ½¹ý ÏëÔÚ ×Ö·û´®ÀïÃæÐ´ SQLÓï¾ä£¬µ«ÊÇ×ÜÊÇÓöµ½ ijЩ·ûºÅ²»»áд.
±ÈÈç˵ÔÚ×Ö·û´®ÀïÃæÐ´¸ö±äÁ¿.
like: str sql="select * from abc where id= ' "++" ' "
idµÄ±äÁ¿Ó¦ ÏÈÓõ¥ÒýºÅÈ»ºó“+”ºÅ¡£
½ñÌìÓöµ½¸öºÜ³¤µÄSQLÓï¾ä£¬¶øÇÒSQLÓï¾äÀïÃæÇ¶Ì×ÁË×Ö·û´®¡£µ±Ê±¸ù±¾²»»áд ......