Ò׽ؽØÍ¼Èí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

SQL´æ´¢¹ý³Ì²âÊÔ£¨9£©——ʾÀý³ÌÐò

      ´Ë²¿·ÖÄÚÈÝ´´½¨Ò»¸öÇáÁ¿¼¶T-SQL²âÊÔÌ×¼þ£¬×ܹ²ÓÐ3¸ö½Å±¾£º
ÓÃÓÚ´´½¨²âÊÔÆ½Ì¨Êý¾ÝºÍ´ý²â´æ´¢¹ý³ÌµÄ½Å±¾
--======================
--makeDbTestAndResults.sql
use master
go
if exists (select * from sysdatabases where name = 'DbTestAndResults')
 drop database makeDbTestAndResults
go
if exists (select * from sysxlogins where name = 'testLogin')
 exec sp_droplogin 'testLogin'
go
create database makeDbTestAndResults
go
use makeDbTestAndResults
go
create table tb1TestCases
(
 caseID char(4) primary key,
 input datetime not null,
 expectedChecksum int not null
)
go
--ÏÂÃæ²åÈëµÄÊÇÓÃÓÚusp_HiredAfterµÄ²âÊÔÊý¾Ý£¬²ÉÓÃÁË¶ÔÆÚÍûÖµÇóУÑéºÍµÄ·½·¨
--Ò²¿ÉÒÔͨ¹ýBCP,BTS»òÕßC#³ÌÐò´ÓÎı¾Îļþ¶ÁÈëÕâЩÊý¾Ý
insert into tb1TestCases values('0001','10/25/2009',1042032)
insert into tb1TestCases values('0002','10/25/2009',9999999)--deliberate error
insert into tb1TestCases values('0003','10/25/2008',25527856)
insert into tb1TestCases values('0004','10/10/2006',1042032)
go
create table tb1Results
(
 caseID char(4) not null,
 result char(4) not null,
 whenRun datetime not null
)
go
exec sp_addlogin 'testLogin','secret'
go
exec sp_grantdbaccess 'testLogin'
go
grant select,insert,delete,update on tb1TestCases to testLogin
go
grant select,insert,delete,update on tb1Results to testLogin
go
--½áÊø½Å±¾
ÓÃÓÚ´´½¨²âÊÔÀýÀýÊý¾ÝºÍ²âÊÔ½á¹û´æ´¢µÄ½Å±¾
--==========================
--makeDbEmployees.sql
use master
go
if exists(select * from sysdatabases where name = 'dbEmployees')
 drop database dbEmployees
go
if exists(select * from sysxlogins where name = 'employeesLogin')
 exec sp_droplogin 'employeesLogin'
go
create database dbEmployees
go
use dbEmployees
go
create table tb1Employees
(
 empID char(3) primary key,
 empLast varchar(35) not null,
 empDOH datetime not null,
)
go
insert into tb1Employees values('e11','Adams','10/25/2009')
insert into tb1Employees


Ïà¹ØÎĵµ£º

SQL Server CLRÈ«¹¦ÂÔÖ®Ò»

      Microsoft SQL Server ÏÖÔھ߱¸Óë Microsoft Windows .NET Framework µÄ¹«¹²ÓïÑÔÔËÐÐʱ (CLR) ×é¼þ¼¯³ÉµÄ¹¦ÄÜ¡£CLR ΪÍйܴúÂëÌṩ·þÎñ£¬ÀýÈç¿çÓïÑÔ¼¯³É¡¢´úÂë·ÃÎʰ²È«ÐÔ¡¢¶ÔÏóÉú´æÆÚ¹ÜÀíÒÔ¼°µ÷ÊԺͷÖÎöÖ§³Ö¡£¶ÔÓÚ SQL Server Óû§ºÍÓ¦ÓóÌÐò¿ª·¢ÈËÔ±À´Ëµ£¬CLR ¼¯³ÉÒâζ×ÅÄúÏÖÔÚ¿ÉÒÔʹÓÃÈκ ......

sqlÖг£Óö¯Ì¬µÄÐÐתÁÐ

//È¡³öÔ´Êý¾Ý
select groupname,totalnum,inputdate,groupid into #temp from
 (select count(*)as totalnum,p.groupid,g.groupname,convert(nvarchar(10),inputdate,120) as 'inputdate'
 from person p left join admin_group g on p.groupid = g.groupid and deleteflag = '0'
 where p.inactive=' ......

sql È«ÎÄË÷Òý

1¡¢ÒªÆôÓÃÈ«ÎÄË÷Òý¹¦ÄÜÊ×ÏÈÐèÒª°²×°full text searchÈ«ÎÄË÷Òý·þÎñ
2¡¢Æô¶¯full text search·þÎñ
3¡¢ÏÈ´´½¨UniqueË÷ÒýºÍÈ«ÎÄË÷Òý£ºCREATE FULLTEXT INDEX ON table_name
4¡¢Ã¿¸ö±íÖ»ÔÊÐí´´½¨Ò»¸öÈ«ÎÄË÷Òý
ɾ³ýÈ«ÎÄË÷Òý DROP FULLTEXT INDEX ON table_name
È«ÎÄËÑË÷Óï¾ä£¬contains(),freeText()
×¢ ......

JDBCÁ¬½ÓSQL Server 2005µÄ·½·¨

Ò»¡¢ÏÂÔØ°²×°
1¡¢SQL Server 2005 Express Edition
ÏÂÔØ SQL Server 2005 Express Edition£¨ÏÂÔØÒ³Ãæ£©£º
http://msdn.microsoft.com/vstudio/express/sql/download/
°²×°ÍêÊý¾Ý¿âºóÉèÖÃICP/IPЭÒéÆô¶¯£¨ÕâÒ»²½²»ÄÜÉÙ£¬Ä¬ÈÏÊÇTCP/IP²»ÆôÓõģ©£¬¾ßÌåÈçÏ£º
£¨1£©´ò¿ªSQL Server Configuration Manager
£¨2£©×ªµ½SQL S ......

´Ó¸÷ÖÖλÖýØÈ¡×Ö·û´®µÄSQLÓï·¨

Öª: ×Ö¶ÎA='F:\photo\Winter Leaves.jpg'  
ÒªÇó:·Ö¶Î½ØÈ¡Ã¿¶Î×Ö·û[×Ö¶ÎA²»ÄÜΪTEXTÀàÐÍ,·ñÔò±¨´í]
½â¾ö·½·¨:
---½ØÈ¡×Ö·û´®AµÄµÚÒ»¸ö\×ó±ßµÄ×Ö·û´®
select left(A,charindex('/',A)-1)
Êä³ö½á¹û£ºF:
---½ØÈ¡\ÖмäµÄ×Ö·û´®
select  left(stuff(A,1,charindex('/',A),''),charindex('/',stuff(A,1,c ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ