SqlServerÖвéѯ10µ½20ÌõÖ®¼äµÄÊý¾Ý
²éѯnorthwindÊý¾Ý¿âÖÐordersÖеÄ10µ½20Ìõ¼Ç¼
select top 10 * from orders
where orderid > ( select max(orderid) from (select top 10 orderid from orders order by orderid) as t )
orders±íÖÐÒÑÓÐ×ÔÔö³¤µÄ±êʶÁÐorderid,
ÏȲé³ö±íÖÐǰʮÌõ¼Ç¼ÖеÄ×î´óorderid£¬
10ÌõÒÔºóµÄorderid¿Ï¶¨´óÓÚǰʮÌõµÄ×î´óid£¬ËùÒÔÔÙwhereÅжϼ´¿É¡£
ÁíÍ⣬Èç¹ûÒª²éѯµÄ±íûÓбêʶÁУ¬Ò²¿ÉÒÔʹÓÃÏÂÃæÕâÖÖ·½·¨£º
select top 20 identity(int ,1,1) as id * into #temp from table
select * from #temp where id>10
Ïà¹ØÎĵµ£º
SELECT convert(char,ÈÕÆÚ×Ö¶Î,120) as date2 from table
mssqlĬÈÏÒÔϵͳʱ¼ä¸ñʽÊä³ö£¬Äã¿ÉÒÔµ÷ÕûϵͳµÄʱ¼ä¸ñʽÀ´½â¾ö
µ±È»ÊÇÔÚ³ÌÐòÀï½â¾ö±È½ÏÁé»î£¬convert(char,date,N)Êä³öµÄ¸÷ÖÖÑùʽ
N ÈÕÆÚÑùʽ
0 04& ......
1.SQLServerµÄ´´½¨½Å±¾ÈçÏ£º
USE [master]
GO
/****** Object: Database [test] Script Date: 10/29/2009 17:43:10 ******/
CREATE DATABASE [test] ON PRIMARY
( NAME = N'test', FILENAME = N'D:\Program Files\Microsoft SQL Server\MSSQL10.MSSQLSERVER\MSSQL\DATA\test.mdf' , S ......
ÓÃwindowsÕ˺ݹÊÇ¿ÉÒԵǼµÄ¡£
²éÕÒÎÊÌâµÄ¹ý³Ì£º
µÚÒ»²½£º Æô¶¯ËùÓÐÓëSQLÓйصķþÎñ£¬ÎÊÌâÒÀ¾É£»
µÚ¶þ²½£º ²é¿´windows·À»ðǽ£¬±»Ä¬ÈÏÆô¶¯ÁË£¬²»Æô¶¯Ñ¡ÔñÏî±»Disabled¡£Á½¸öÌáʾ“ÓÉÓÚ°²È«¿¼ÂÇ,ijЩÉèÖÃÓÉ×é²ßÂÔ¿ØÖÆ”“Windows·À»ðǽÕýÔÚʹÓÃÄúµÄÓòÉèÖÔ£¬ÏÈÓÃgpedit.msc´ò×é²ßÂÔ±à¼Æ÷£¬» ......
ÔÚSQLÓï¾äÖÐͨ¹ýϵͳ´æ´¢¹ýsp_addextendedproperty¿ÉΪ±í×Ö¶ÎÌí¼ÓÉ϶¯Ì¬µÄ˵Ã÷£¨±¸×¢£©ÏÂÃæÊÇSQL SERVER°ïÖúÎĵµÖжÔsp_addextendedproperty´æ´¢¹ý³ÌµÄÃèÊö
Óï·¨
sp_addextendedproperty
[ @name = ] { 'property_name' }
[ , [ @value = ] { 'value' }
&nbs ......