SQLServer»ñȡÿ×éÇ°10%µÄÊý¾Ý
sqlserver2005Óйؼü×Öntile(x)ºÍover(partition by.. order by..)×Ó¾äÅäºÏ.
±ÈÈç»ñȡÿ¸ö±íµÄÇ°10%¸ö×ֶΡ£
select id , name , colid , rn from (
select * , rn = ntile (10 )
over (partition by id order by colorder )
from syscolumns )t where rn = 1
Ïà¹ØÎĵµ£º
ÒýÓÃ×Ôhttp://blog.163.com/xing_aixin/blog/static/3723550520088189201623/
ÍøÉÏÓкܶàSQL ServerÊý¾Ý¿â×ÖµäµÄSQLÓï¾ä£¬ÆßÁã°ËÂ䣬ÎÒÔÚ¹¤×÷ÕûÀíÁËÒ»ÏÂ˼·£¬×ܽáSQL´úÂëÈçÏ¡£Êý¾Ý¿â×Öµä°üÀ¨±í½á¹¹(·Ö2KºÍ2005)¡¢Ë÷ÒýºÍÖ÷¼ü. Íâ¼ü.Ô¼Êø.ÊÓͼ.º¯Êý.´æ´¢¹ý³Ì.´¥·¢Æ÷¡£¿ÉÒÔÔÚÆóÒµ¹ÜÀíÆ÷¡¢²éѯ·ÖÎöÆ÷Öмòµ¥Ö´ÐУ¬Ö±½ÓÁ˵±µ ......
//ÕâÊÇÌí¼Ó
private void button1_Click(object sender, EventArgs e)
{
string s = "Persist Security Info=False;Integrated Security=SSPI;database=IIntegration;server=(local)";
&n ......
SQL Server 2005Êý¾Ý¿â±¸·ÝºÍ»Ö¸´ÌØÐÔ
SQL Server 2000ÖдæÔÚµÄÐí¶àµÄ±¸·ÝºÍ»Ö¸´ÌØÐÔ¶¼Í¬Ñù±£ÁôÔÚÁËSQL Server 2005ÖУ¬µ«ÊÇÓÐһЩеÄÌá¸ßͬÑùÖµµÃÎÒÃǹØ×¢¡£
¾µÏñ±¸·Ý
SQL Server 2005ÈÃÄã¿ÉÒÔ´´½¨¾µÏñ±¸·Ý¡£¾µÏñ±¸·ÝÔÊÐíÄãΪ±¸·ÝÎļþ´´½¨Á½¸ö»òÕßËĸöͬÑùµÄ¿½±´£¬ÒÔ·À±¸ÆäÖеÄijһ¸ö¼¯ºÏË𻵵ÄÇé¿ö¡£¾µÏñ¾ßÓ ......
Ö»ÈÃÖ¸¶¨µÄ»úÆ÷Á¬½ÓSQLServer·þÎñÆ÷ ÊÕ²Ø
±³¾°
Ö»Ïëʹij¸öIPµÄ¼ÆËã»ú²ÅÄÜÁ¬½Óµ½SQL Server·þÎñÆ÷£¬²»ÔÊÐíÆäËû¿Í»§¶ËÁ¬½Ó¡£
½â¾ö·½·¨
¿ÉÒÔÖ±½ÓÔÚ·À»ðǽÖÐ×öÏÞÖÆ£¬Ö»ÔÊÐíÓëÖ¸¶¨µÄIPµØÖ·½¨Á¢1433µÄͨѶ¡£µ±È»£¬´Ó¸üΪ°²È«µÄ½Ç¶ÈÀ´¿¼ÂÇ£¬Ó¦¸Ã°Ñ1433¶Ë¿Ú¸Ä³ÉÆäËûµÄ¶Ë¿Ú¡£
ÆäËû½â¾ö·½·¨1£¨ÏÞ´ÓÖ¸¶¨IP½ÓÈëµÄ¿Í»§¶Ë£©
Èç¹ûʹ ......
SqlserverµÃµ½ºº×ÖÆ´ÒôÊ××Öĸ´æ´¢¹ý³Ì:
create function [dbo].[fun_getPY]
(
@str nvarchar(4000)
)
returns nvarchar(4000)
as
begin
declare @word nchar(1),@PY nvarchar(4000)
set @PY=''
while len(@str)>0
begin
set @word=left(@str,1)
--Èç¹û·Çºº×Ö×Ö·û£¬·µ»ØÔ×Ö·û
& ......