¼òµ¥µÄsqlµÇ¼ºÍ×¢²á´æ´¢¹ý³Ì
Ê×ÏÈÎÒ½¨ºÃÁËÒ»ÕÅÓû§±í±íÖÐÓÐÁ©¸ö×ֶΠһ¸öÊÇÕ˺ţ¬Ò»¸öÊÇÃÜÂ뵱ȻÕâÀïÎÒдµÄ֪ʶ¼òµ¥µÄµÇ¼ºÜ×¢²á£¬
±íÃ÷ users Óû§±í
×ֶΠaccountnum varchar(50) --±íʾÕ˺Å
password varchar(50) --±íʾÃÜÂë
µÇ¼´æ´¢¹ý³Ì
create proc use_login
(
@accountnum varchar(50),
@password varchar(50),
@message varchar(50) output
)
as
if exists(select * from users where accountnum=@accountnum and password=@password)
set @message='µÇ¼³É¹¦'
else if exists(select * from users where accountnum=@accountnum )
set @message='ÃÜÂë´íÎó'
else if exists(select * from users where password=@password)
set @message='Óû§Ãû´íÎó'
else
set @message='Óû§ÃûºÍÃÜÂ붼´íÎó'
declare @msg as varchar(50)
exec use_login 'text','text',@msg output
print @msg
×¢²á´æ´¢¹ý³Ì
create proc use_registration
(
@accountnum varchar(50),
@password varchar(50),
@message varchar(50) output
)
as
if exists(select * from users where accountnum=@accountnum)
set @message='¸ÃÓû§ÒѾ´æÔÚ'
else
begin
insert into users values(@accountnum,@password)
set @message='¹§Ï²Äú£¬¿ÉÒÔ×¢²á¸ÃÓû§'
end
declare @msg as varchar(50)
exec use_registration 'text','text',@msg output
print @msg
ÉÏÃæÔÙÖ´Ðд洢¹ý³ÌµÄʱºò Òª´òÓ¡ËùÒªÏÔʾ³öÀ´µÄÐÅÏ¢ÓõÄÊÇprint Ò²¿ÉÒÔÓÃselect
Ïà¹ØÎĵµ£º
¿Î³Ì½éÉÜ
SQL Server 2008ÊÇ΢ÈíµÄ×îÐÂÊý¾Ý¿âϵͳ,ÆäÔÚÔÓÐSQL Server 2005µÄ»ù´¡ÉÏ,½øÐÐÁËÖØ´óµÄ¸Ä½ø¡£±¾¿Î³Ì½«´Óά»¤Ó뿪·¢Á½¸ö·½Ãæ½øÐнÏϵͳµØ½²Êö£¬Ê¹Ñ§Ô±Äܹ»ÊìÁ·Ê¹ÓÃSQL Server 2008¿ª·¢Ç¿½¡µÄÊý¾Ý¿âÓ¦Óá£
Êʺ϶ÔÏó
Êý¾Ý¿â¹ÜÀí»ò¿ª·¢ÈËÔ±
¿Î³Ì³¤¶È
& ......
1.
Ä£ºý²éѯЧÂʺܵͣº
ÔÒò£º
like
±¾ÉíЧÂʾͱȽϵͣ¬Ó¦¸Ã¾¡Á¿±ÜÃâ²éѯÌõ¼þʹÓÃ
like
£»¶ÔÓÚ
like ‘%...%’
£¨È«Ä£ºý£©ÕâÑùµÄÌõ¼þ£¬ÊÇÎÞ·¨Ê¹ÓÃË÷ÒýµÄ£¬È«±íɨÃè×ÔȻЧÂʺܵͣ»ÁíÍ⣬ÓÉÓÚÆ¥ÅäËã·¨µÄ¹Øϵ£¬Ä£ºý²éѯµÄ×ֶ㤶ÈÔ½´ó£¬Ä£ºý²éѯЧÂÊÔ½µÍ¡£
½â¾ö°ì· ......
±êÇ©£ºÊý¾Ý·ÃÎÊ ADO.NET
DataAdapter ¶ÔÏóÖеÄSQLÃüÁî ×¢£ºADO.NET¶ÔÏóÄ£ÐÍ ºÍ C# Òª±È SQL ¸üÊʺϴ¦Àí¸´ÔÓÔËËã ºÍ µ¼º½Âß¼£¨±ÈÈ磬²éÕÒÏà¹ØµÄÁíÒ»¸ö±íµÄÊý¾Ý£©
......
Êý¾Ý¿â²Ù×÷£ºÀûÓú¯Êý¼õÉÙ´æ´¢¿Õ¼ä£¨ÒÔʱ¼ä»»È¡¿Õ¼ä£©
ÀýÈçÒ»¸ö±íÓÐIPÁУ¬ÔÚ´æ´¢µÄʱºòÎÒÃÇΪÁ˼õÉÙ´æ´¢¿Õ¼ä£¬¿ÉÒÔ½«Ëüת»¯ÎªÕûÊý£¬´æ´¢ÔÚÊý¾Ý¿â£¬µ«ÊÇÔÚ´ÓÊý¾Ý¿âÀï²éѯ²¢ÏÔʾ¸ø´ó¼Ò¿´µÄʱºò£¬¿ÉÄÜÄãÊÇ¿´²»Ã÷°×ÕûÊý¾ßÌåÊÇʲô¡£ÕâÑùΪÁËÀûÓÚ´ó¼ÒÔĶÁ·ÖÎöÊý¾Ý£¬¿ÉÒÔÔÚ²éѯµÄʱºòÀûÓú¯Êý½«ÕûÊýIPתΪΪ×Ö·û´®
ÀýÈ磺
&nbs ......
USE master
GO
CREATE DATABASE testbase2
ON
PRIMARY
(NAME = prim_sub_dat1,
FILENAME = 'G:\SQL SERVER2000\prim_sub_dat.mdf',
SIZE = 5MB,
MAXSIZE = 50MB,
FILEGROWTH = 20%),
(NAME = prim_sub_dat2,
FILENAME = 'G:\SQL SERVER2000\prim_sub_dat.ndf'
SIZE = 5MB,
MAXSIZE = 50MB,
......