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

·ÀÖ¹SQL SERVERµÄʼþ̽²éÆ÷¸ú×Ù³ÌÐòÖÐSQL½Å±¾

ÈçºÎ·ÀÖ¹³ÌÐòÖÐSQL½Å±¾±»SQL SERVERµÄʼþ̽²éÆ÷¸ú×Ù£¬±£ÕÏ×Ô¼ºµÄÈí¼þ²»±»ËûÈË·ÖÎö£¿
ÏÂÃæÊÇÒ»¸öÍ£Ö¹ËùÓÐSQLSERVERµÄ¸ú×ÙÆ÷µÄ½Å±¾(Á½ÖÖ·½·¨µÄÔ­ÀíÏàͬ)£º
µÚÒ»ÖÖ·½·¨£º
procedure SQLCloseAllTrack;
const
sql = 'declare @TID integer ' +
'declare Trac Cursor For ' +
'SELECT Distinct Traceid from :: fn_trace_getinfo(default) ' +
'open Trac ' +
'Fetch Next from Trac into @TID ' +
'while @@fetch_status=0 ' +
'begin ' +
' exec sp_trace_setstatus @TID,0 ' +
' exec sp_trace_setstatus @TID,2 ' +
' Fetch Next from Trac into @TID ' +
'end ' +
'Close Trac ' +
'deallocate Trac';
begin
//Í£Ö¹ËùÓÐSQLSERVERµÄ¸ú×ÙÆ÷,ÒÔ·ÀÖ¹³ÌÐò±»別È˸ú×Ù
ExecSql(sql);
end;
µÚ¶þÖÖ·½·¨£º
with faq1 do
begin
Close;
sql.Clear;
sql.add('declare @t_count int');
sql.add('set @t_count=1');
sql.add('while exists(SELECT * from ::::fn_trace_geteventinfo(@t_count))');
sql.add('begin');
sql.add('exec sp_trace_setstatus @t_count,0');
sql.add('set @t_count=@t_count+1');
sql.add('end');
try
execSQL;
except;
end;
close;sql.Clear;
end;
end;


Ïà¹ØÎĵµ£º

¹ØÓÚDB2 sql:0206n ´íÎó

½ñÌìÅöµ½Ò»¸ösql:0206nµÄ´íÎó£¬ÎÒʹÓÃselect * from xxx¿ÉÒԲ鿴±í½á¹¹ºÍÄÚÈÝ£¬È»¶øµ±ÎÒʹÓÃselect aaa from xxxµÄʱºòÈ´¸øÎÒ±¨´í£¬×îºóÅŲéÔ­ÒòÊÇÎÒʹÓù¤¾ß½¨±í£¬½¨±íÓï¾äÊÇÀàËÆÕâÑùµÄ£ºcreate table("id" int,"name" varchar)£¬ºÃÁ˽á¹û¾ÍÊÇ×ֶθø¼ÓÁËÒýºÅ£¬ÔÚ²éѯµÄʱºòʹÓÃ*¿ÉÒÔ²éѯ£¬Ê¹Óõ¥¸ö×ֶβ»Äܲéѯ£¬ÎÒ¹À¼Æ¾ÍÊ ......

sql server°²×°°æ±¾²é¿´


SELECT SERVERPROPERTY('productversion'), SERVERPROPERTY ('productlevel'), SERVERPROPERTY ('edition')
productversion£º²úÆ·°æ±¾£¨ÀýÈ磬10.0.1600.22£©
productlevel£º²úÆ·¼¶±ð£¨ÀýÈ磬RTM£©
edition£º°æ±¾£¨ÀýÈ磬 Enterprise£¨ÆóÒµ°æ£©¡¢Developer Edition£¨¿ª·¢°æ£©£©
SELECT @@VERSION
΢Èí¾ßÌå˵Ã÷£º
......

sql¶à±íÁªºÏ²éѯµÄÎÊÌâ

ÏÖÔÚÓöµ½Á˸öÊý¾Ý¿â²éÕÒµÄÎÊÌ⣬Á¬½Ó²éÕÒ£¬ÏÖÔÚÓÐÈý¸ö±íusers ±í£¬sex±í£¬languages±í£¬sex±íÖеÄlang_id ºÍmotherlang_idÊÇÖ÷¼üÍâ¼ü¹ØÏµ
ͼƬ£º
ÁªºÏ²éÕÒÐÅϢʱ
Èç¹ûÐÅÏ¢ÍêÕûµÄ»°ÊÇ¿ÉÒÔ²éÕÒ³öÀ´µÄ£¬µ«ÊÇÐÅÏ¢²»ÍêÕûµÄ»°¾Í²îÕÒ²»³öÀ´¡££¨Èç Óû§tanaka¾ÍÎÞ·¨²é³öÐÅÏ¢£©²éÕÒÓï¾äÈçÏ£º
select users.id,username,sex_name ......

Êý¾Ý¿â×é¼þ Hxj.Data£¨Æß£© (sqlƪ)

ÉÏÒ»½Ú½²ÊöµÄÊÇɾ³ý²Ù×÷£¬±¾½Ú½«½²ÊöÈçºÎÖ±½ÓÖ´ÐÐsqlÓï¾ä¡£ Ö±½ÓÖ´ÐÐsqlÓï¾äÊÇʹÓÃfromSql·½·¨¡£ DbSession.Default.fromSql("select * from products").ToDataTable();
 
ÕâÑù¿´ÆðÀ´Ç×ÇжàÁ˰ɣ¬Ö±½Ósql¾Í¿ÉÒÔÖ´ÐС£
 
µ±È»Ò²¿ÉÌí¼Ó²ÎÊýµÄ°¡¡£
DbSession.Default.fromSql("select * ......

sqlÖÐÑ­»·²åÈë´óÁ¿²âÊÔÊý¾Ý

declare @a int
set @a = 1  
while @a<1000000  
begin
    insert into Test(name) values(@a)  
    set @a = @a + 1  
end ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ