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
Ïà¹ØÎĵµ£º
ÔÚ°²×°SQL Server 2005¿ª·¢°æÊ±³öÏÖÎÊÌâ¡£°²×°»·¾³Îªwindows xp sp3£¬°²×°Óû§Ê¹Ó󬼶¹ÜÀíÔ±£¨Administrator£©¡£³öÏֵĴíÎóÊÇ
ÔÚ°²×°“Integration Services”²½Öèʱ³öÏÖ°²×°´íÎó£¬Ìáʾ“´íÎó: -2146233087”¡£
´íÎó¼Ç¼
±êÌâ:
Microsoft SQL Server 2005 °²×°³ÌÐò
ÎÞ·¨ÔÚ COM+ Ŀ¼Öа²×°ºÍÅäÖ ......
--1.¹ØÓÚwhereɸѡÆ÷ÖгöÏÖÖ¸¶¨ÐÇÆÚ¼¸µÄÇó½â
SQL code
--»·¾³
create table test_1
(
id int,
value varchar(10),
t_time datetime
)
insert test_1
select 1,'a','2009-04-19' union
select 2,'b','2009-04-20' union
select 3,'c','2009-04-21' union
select 4,'d','2009-04-22' union
s ......
×¢ÊÍ:Ö»Êʺϵ¥±íµ¥ÁÐÊý¾Ý,
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£¬¿É»ñµÃ°ü ......