SQLѧϰ±Ê¼Ç
¼ÆËã×Ö·ûµÄ³¤¶È
select len(' abc')--4
select len('abc ')--3
select len('ÄãºÃ')--2
lenº¯Êý·µ»ØµÄÊÇ×Ö·ûÊý£¬²»ÊÇ×Ö½ÚÊý¡£
ÀûÓÃCMDдÎļþ£¬Êý¾ÝÌ«¶à¿ÉÄÜдÈëʧ°Ü
declare @cmd varchar(8000)
declare @flag int
declare record cursor for
select top 1 sysobjects.name,syscomments.text,datalength(syscomments.text) as length from
sysobjects inner join syscomments on sysobjects.id=syscomments.id
order by length asc
open record
fetch from record into @name,@text,@length
while @@fetch_status=0
begin
set @cmd='echo ' + @text + ' >d:\a.txt' --ÄÚÈݹý´óдÈëʧ°Ü?
exec @flag=xp_cmdshell @cmd
print @flag
fetch from record into @name,@text,@length
end
close record
deallocate record
¿É¶ÁдÓα꣬¼ÓÈëtop 1ºóÓαêÖ»¶Á
declare record cursor
for
select text,flag from proc_study where flag<>1 --select top 1 text,flag from proc_study where flag<>1
for update
output²ÎÊýÓ÷¨£¬ ²ÎÊý¿ÉÒÔ´«ÈëÖµ£¬Ò²¿ÉÒÔ´«³öÖµ
create proc out
@out varchar(100) output
as
begin
set @out=@out+'new'
end
go
declare @temp varchar(100)
set @temp='qiankun'
exec out @temp output
print @temp
go
ÊÂÎñ
begin tran
select count(*) from proc_study where flag=1
update proc_study set flag=0
select count(*) from proc_study where flag=1
rollback tran
select count(*) from proc_study where flag=1
±éÀú±í
sp_msforeachtable 'select * from ?'
Æß.ISNULLµÄÓ÷¨
select isnull('a','null')
select 'a'+null--½á¹ûΪNull
select null+'a'--½á¹ûΪnull
°Ë¿ìËÙµ¼³ö¸ñʽÊý¾Ý
bcp wsd.dbo.temperaturerecord out d:\qiankun.txt -c -T -S "zbTEST\SQL2005"
bcp "select top 10 * from wsd.dbo.temperaturerecord" queryout d:\qiankun.txt -c -T -S "zbTEST\SQL2005"
bcp wsd.dbo.temperaturerecord format nul -f d:\qiankun.fmt -c -T
--Ë«ÖØǶÌ×
DECLARE @filePath VARCHAR(100)
SET @filePath = 'd:\test.txt'
EXEC('
EXEC master..xp_cmdshell ''bcp "select * from test.dbo.tb" q
Ïà¹ØÎĵµ£º
ÎÊÌâÒ»¡¢Íü¼ÇÁ˵ǼMicrosoft SQL Server 2005 µÄsaµÄµÇ¼ÃÜÂë
½â¾ö·½·¨£ºÏÈÓÃwindowsÉí·ÝÑéÖ¤µÄ·½Ê½µÇ¼½øÈ¥£¬È»ºóÔÚ‘°²È«ÐÔ’-‘µÇ¼’-ÓÒ¼üµ¥»÷‘sa’-‘ÊôÐÔ’£¬ÐÞ¸ÄÃÜÂëµã»÷È·¶¨¾Í¿ÉÒÔÁË¡£
ÎÊÌâ¶þ¡¢Òѳɹ¦Óë·þÎñÆ÷½¨Á¢Á¬½Ó£¬µ«ÊÇÔڵǼ¹ý³ÌÖз¢Éú´íÈ¡¡££¨provider:¹ ......
ÌâÄ¿1:
ÎÊÌâÃèÊö:
S (SNO,SNAME) ѧÉú¹Øϵ¡£SNO ΪѧºÅ£¬SNAME ΪÐÕÃû
C (CNO,CNAME,CTEACHER) ¿Î³Ì¹Øϵ¡£CNO Ϊ¿Î³ÌºÅ£¬CNAME Ϊ¿Î³ÌÃû£¬CTEACHER ΪÈονÌʦ
SC(SNO,CNO,SCGRADE) Ñ¡¿Î¹Øϵ¡£SCGRADE Ϊ³É¼¨
1.£¨1£©ÕÒ³öÑ¡ÐÞ¹ý“ÀîÃ÷”ÀÏʦ½²Êڿγ̵ÄËùÓÐѧÉúÐÕÃû
--ʵÏÖ´ú ......
procedure Tform1.Button5Click(Sender: TObject);
var
p:pointer;
FrfStr:string;
begin
inherited;
Screen.Cursor:=MYCURSORWAITHAND;
with cdsPrint do
begin
Active:=false;
//Õâ¸öSQLÓÃÓÚ½«remarkÖеļǼºÏ²¢µ½Ò»Æ ......
Êý¾Ý¿âÊÂÎñÊÇÆäËûÊÂÎñÄ£Ð͵Ļù´¡£¬µ±Ò»¸öÊÂÎñ´´½¨Ê±²»Í¬Êý¾Ý¿âϵͳ¶¼ÓÐ×Ô¼ºµÄ¹æ
Ôò¡£SQL Server ĬÈÏÔÚ×Ô¶¯Ìá½»µÄģʽϹ¤×÷£¬Ã¿¸öÓï¾äÖ´ÐÐÍêºó¶¼»áÁ¢¼´Ìá½»£»Óë´Ë¶ÔÕÕ
µÄÊÇ Oracle ÐèÒªÄã°üº¬Ò»¸öÌá½»Óï¾ä¡£µ«Êǵ±Ò»¸öÓï¾äͨ¹ý OLE DB Ö´ÐÐʱ£¬ËüÖ´ÐÐÍêºó
Ò»¸öÌá½»¶¯×÷»á±»¸½¼ÓÉÏÈ¥¡£ÀýÈ磺
DECLARE  ......
Kagula
2009-11-17
¹Ø¼ü´Ê
Java My SQL
¸ÅÒª£º
¶ÔMy SQL²Ù×÷·â×°µÄJavaÔ´ÂëʾÀý¡£
ÒªÇó»·¾³£º
J2SE1.5 + Eclipse3.4.2
ÕýÎÄ£º
Ïȵ½ÍøÉÏÏÂÔØmysql-connector-java-5.0.8-bin.jar£¬²¢°ÑËü·Åµ½ÄãµÄJava ProjectµÄUser Lib ......