sqlServerÓû§saµÇ¼²»ÉÏÁË
±êÌâ: Á¬½Óµ½·þÎñÆ÷
------------------------------
ÎÞ·¨Á¬½Óµ½ LIJINING-PC¡£
------------------------------
ÆäËûÐÅÏ¢:
Òѳɹ¦Óë·þÎñÆ÷½¨Á¢Á¬½Ó£¬µ«ÊÇÔڵǼ¹ý³ÌÖз¢Éú´íÎó¡£ (provider: ¹²ÏíÄÚ´æÌṩ³ÌÐò, error: 0 - ¹ÜµÀµÄÁíÒ»¶ËÉÏÎÞÈκνø³Ì¡£) (Microsoft SQL Server£¬´íÎó: 233)
ÓйذïÖúÐÅÏ¢£¬Çëµ¥»÷: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&EvtSrc=MSSQLServer&EvtID=233&LinkId=20476
------------------------------
°´Å¥:
È·¶¨
------------------------------
SQL code:
--try
Ê×ÏÈÑ¡ÖзþÎñÆ÷(ÓÒ¼ü)->ÊôÐÔ->°²È«ÐÔ->·þÎñÆ÷Éí·ÝÑéÖ¤ÐÞ¸ÄΪ"SQL SERVERºÍWINDOWSÉí·ÝÑé֤ģʽ"
Æä´ÎÕ¹¿ª·þÎñÆ÷ÉϵÄ"°²È«ÐÔ"->µÇ½Ãû->Ñ¡ÖÐSAµÇ½ÕʺÅ(ÓÒ¼ü)->״̬->µÇ½ÐÞ¸ÄΪÆôÓÃ
¶¼ÉèÖùýÁË£¬Ö®Ç°ÊÇÄܵǼÉÏ£¬Í»È»¾Í²»ÐÐÁË
ÊDz»ÊÇÉèÖÃÃüÃû¹ÜµÀÁË£¿Ò»°ãÉèÖÃÃüÃû¹ÜµÀºó»áµ¼ÖÂÎÞ·¨Á¬½Ó¡£°ÑÃüÃû¹ÜµÀ½ûµô¿´¿´¡£
Ïà¹ØÎÊ´ð£º
sqlserverÖж¨Òå×Ö¶Îʱ£¬ÓбêʶÖÖ×Ó¡¢±êʶºÍ¹«Ê½µÈ£¬ÊÇʲôÒâ˼£¿
Ó¦¸Ã˵µÄÊÇidentity°É
identity?ɶÒâ˼£¿
IDENTITY£¨º¯Êý£©
Ö»ÓÃÔÚ´øÓÐ INTO table ×Ó¾äµÄ SELECT Óï¾äÖУ¬ÒÔ½«±êʶÁвåÈ뵽бíÖС£
¾¡¹ ......
ÓÐһ̨Êý¾Ý¿â·þÎñÆ÷£¬¿Í»§¶ËʹÓÃADO.NETÁ¬½Ósql£¬Ê¹ÓÃExecuteScalarÖ´ÐÐSQL INSERTÓï¾ä£¬È»ºó¿Í»§¶Ëˢв»Äܲéѯµ½ÐÂINSERTµÄÊý¾Ý£¬¹ý10Ãë×óÓÒ²ÅÄܲ鵽ÐÂÊý¾Ý
ʲôÔÒò
Äã×öÁË»º´æÂð£¿
û×ö»º´æ
Ôõô»áÄØ£¡ ......
лл
SQL code:
exec sp_lock --¿´ objId
È»ºóÓÃ
select object_name(ObjID)
ÒýÓÃ
SQL codeexec sp_lock--¿´ objId
È»ºóÓÃselectobject_name(ObjID)
ÎÒÔÚ²éѯ·ÖÎöÆ÷ÀïÃæ,Ôõô²»ÄÜÖ´ÐÐÄØ? ......
¸÷λ´óϺÃÇ
sqlserverÔõôȡµ½ÕâÑù¸ñʽµÄÈÕÆÚ°¡£¿
20100223£¬²»Òª2010-02-23ÕâÑùµÄ
лл
SQL code:
select convert(varchar(10),getdate(),112)
----------
20100223
(1 ÐÐÊÜÓ°Ïì)
SQL code:
......
Sqlserver±í½á¹¹
Create table test
(
int parentID primary key identity(1,1),
int childID
)go
ps:childIDÖ¸¶¨parentIDÖµ
ÓÐÈçÏÂÊý¾Ý
parentID childID
1   ......