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
Ïà¹ØÎĵµ£º
ÊÀʶ´Ã÷½ÔѧÎÊ£¬ÈËÇéÁ·´ï¼´ÎÄÕ¡£×öASPʱ£¬×î³£ÓõÄÊý¾Ý¿â¼´SqlserverÓëAccessÊý¾Ý¿âĪÊôÁË£¡
µ«Ê¹Óûᾳ£·¢ÏֺܶàSQLÖ´ÐеÄÎÊÌâ¡£ÕâÀïÕûÀí³öÖ®¼äµÄ²îÒ죬×ö¸öÊ®´ó²îÒìµÄ×ܽᡣ
ACCESS½á¹¹¼òµ¥ÈÝÒ×´¦Àí£¬¶øÇÒÒ²ÄÜÂú×ã¶àÊýµÄÍøÕ¾³ÌÐòÒªÇó£¬Ò²ÊdzõѧÕßµÄÊÔÅ£µ¶¡£
ACCESSÊÇСÐÍÊý¾Ý¿â£¬¼ÈÈ»ÊÇСÐ;ÍÓÐËû¸ù±¾µÄ¾ÖÏÞÐÔ£º
......
procedure Tform1.Button5Click(Sender: TObject);
var
p:pointer;
FrfStr:string;
begin
inherited;
Screen.Cursor:=MYCURSORWAITHAND;
with cdsPrint do
begin
Active:=false;
//Õâ¸öSQLÓÃÓÚ½«remarkÖеļǼºÏ²¢µ½Ò»Æ ......
SQL²åÈëÓï¾äµÃµ½×Ô¶¯Éú³ÉµÄµÝÔö ID Öµ
insert into Table1(Name,des,num) values ('ltp','thisisbest',10);
select @@identity as 'Id'
Ëæ»úÌáÈ¡Ìõ¼Ç¼µÄÀý×Ó
SQL Server£ºSelect Top 10 * from Tablename Order ......
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 ......