SQL ServerÑ¡ÔñÁ˷Ǿۼ¯Ë÷Òý¶ø²»ÊǾۼ¯Ë÷Òý
¾Û¼¯Ë÷Òý²»½ö°üº¬Ë÷ÒýµÄkeyÖµ£¬»¹°üº¬±íÊý¾Ý£»
·Ç¾Û¼¯Ë÷ÒýÖ»°üº¬Ë÷ÒýµÄkeyÖµ¡£
SQL ServerÔÚÓÐЩÇé¿öÏ£¬Óоۼ¯Ë÷ÒýºÍ·Ç¾Û¼¯Ë÷Òý´æÔÚʱ£¬»áÑ¡Ôñ×߷Ǿۼ¯Ë÷Òý£¬¶ø²»×ß¾Û¼¯Ë÷Òý¡£
Àý×ÓÈçÏ£º
ÔÚ SQL Server µÄadventureWorksÊý¾Ý¿âÏ£¬ÔËÐÐÈçÏÂÓï¾ä£º
select DepartmentID,Name from HumanResources.Department
Department±íÉÏÓÐÁ½¸öË÷Òý£¬Ò»¸öÊÇdepartmentidÉϵľۼ¯Ë÷Òý£¬ÁíÒ»¸öÊÇnameÉϵķǾۼ¯Ë÷Òý£»
¸ÃÓï¾äµÄÔËÐнá¹ûÈçÏ£º
DepartmentID Name
12 Document Control
1 Engineering
16 Executive
14 Facilities and Maintenance
10 Finance
9 Human Resources
11 Information Services
4 Marketing
7 Production
8 Production Control
5 Purchasing
13 Quality Assurance
6 Research and Development
3 Sales
15 Shipping and Receiving
2 Tool Design
¿ÉÒÔ¿´µ½½á¹ûÊÇ°´ÔÚnameµÄÉýÐòÅÅÁеģ¬ËµÃ÷ʹÓõÄÊÇnameÉϵķǾۼ¯Ë÷Òý¡£
Èç¹û´æÔÚÁíÍâÒ»¸öûÓÐË÷ÒýµÄÁУ¬Ôò»áÑ¡Ôñ×ßdepartmentidÉϵľۼ¯Ë÷Òý£¬ÒòΪsql server»áÈÏΪÕâÑùµÄËٶȱȽϿ졣
select DepartmentID,Name,GroupName from HumanResources.Department
DepartmentID Name GroupName
1 Engineering Research and Development
2 Tool Design Research and Development
3 Sales Sales and Marketing
4 Marketing Sales and Marketing
5 Purchasing Inventory Management
6 Research and Development Research and Development
7 Production Manufacturing
8 Production Control Manufacturing
9 Human Resources Executive General and Adm
Ïà¹ØÎĵµ£º
¾¡Á¿ÉÙÓÃIN²Ù×÷·û£¬»ù±¾ÉÏËùÓеÄIN²Ù×÷·û¶¼¿ÉÒÔÓÃEXISTS´úÌæ¡£
²»ÓÃNOT IN²Ù×÷·û£¬¿ÉÒÔÓÃNOT EXISTS»òÕßÍâÁ¬½Ó+Ìæ´ú¡£
OracleÔÚÖ´ÐÐIN×Ó²éѯʱ£¬Ê×ÏÈÖ´ÐÐ×Ó²éѯ£¬½«²éѯ½á¹û·ÅÈëÁÙʱ±íÔÙÖ´ÐÐÖ÷²éѯ¡£¶øEXISTÔòÊÇÊ×Ïȼì²éÖ÷²éѯ£¬È»ºóÔËÐÐ×Ó²éѯֱµ½ÕÒµ½µÚÒ»¸öÆ¥ÅäÏî¡£NOT EXISTS±ÈNOT INЧÂÊÉԸߡ£µ«¾ßÌåÔÚÑ¡ÔñIN»òEXIST² ......
¿ÉÒÔ¶¨ÒåÒ»¸öÎÞÂÛºÎʱÓÃINSERTÓï¾äÏò±íÖвåÈëÊý¾Ýʱ¶¼»áÖ´ÐеĴ¥·¢Æ÷¡£
¡¡¡¡µ±´¥·¢INSERT´¥·¢Æ÷ʱ£¬ÐµÄÊý¾ÝÐоͻᱻ²åÈëµ½´¥·¢Æ÷±íºÍinserted±íÖС£inserted±íÊÇÒ»¸öÂß¼±í£¬Ëü°üº¬ÁËÒѾ²åÈëµÄÊý¾ÝÐеÄÒ»¸ö¸±±¾¡£inserted±í°üº¬ÁËINSERTÓï¾äÖÐÒѼǼµÄ²åÈ붯×÷¡£inserted±í»¹ÔÊÐíÒýÓÃÓɳõʼ»¯INSERTÓï¾ä¶ø²úÉúµÄÈÕÖ¾Êý¾Ý ......
ÔÚ°²×°SQL Server 2005¿ª·¢°æʱ³öÏÖÎÊÌâ¡£°²×°»·¾³Îªwindows xp sp3£¬°²×°Óû§Ê¹Ó󬼶¹ÜÀíÔ±£¨Administrator£©¡£³öÏֵĴíÎóÊÇ
ÔÚ°²×°“Integration Services”²½Öèʱ³öÏÖ°²×°´íÎó£¬Ìáʾ“´íÎó: -2146233087”¡£
´íÎó¼Ç¼
±êÌâ:
Microsoft SQL Server 2005 °²×°³ÌÐò
ÎÞ·¨ÔÚ COM+ Ŀ¼Öа²×°ºÍÅäÖ ......
×¢ÊÍ:Ö»Êʺϵ¥±íµ¥ÁÐÊý¾Ý,
create database test
go
use test
go
create table users
(
:id int identity(1,1) primary key not null,
:name nvarchar(20)
)
go
create proc sp_Inserts
@Names nvarchar(4000)
as
declare @Name nvarchar(20),@ErrorSum int
:set @ErrorSum = 0
:begin tra ......
CONVERT
½«Ä³ÖÖÊý¾ÝÀàÐ͵ıí´ïʽÏÔʽת»»ÎªÁíÒ»ÖÖÊý¾ÝÀàÐÍ¡£ÓÉÓÚijЩÐèÇó¾³£Óõ½È¡ÈÕÆÚ¸ñʽµÄ²»Í¬.ÏÖÒÔÏ¿ÉÔÚ
SQL ServerÖÐ ½«ÈÕÆÚ¸ñʽ»¯.
SQL Server Ö§³ÖʹÓÿÆÍþÌØËã·¨µÄ°¢À²®ÑùʽÖеÄÊý¾Ý¸ñʽ¡£
ÔÚ±íÖУ¬×ó²àµÄÁ½Áбíʾ½« datetime »ò smalldatetime ת»»Îª×Ö·ûÊý¾ÝµÄ style Öµ¡£¸ø style Öµ¼Ó 100£¬¿É»ñµÃ°ü ......