SQL Server 2008 ¶Ô T SQL ÓïÑÔµÄÔöÇ¿
Microsoft SQL Server 2008 ¶Ô T-SQL ÓïÑÔ½øÐÐÁ˽øÒ»²½ÔöÇ¿¡£ÎªÁËÈÿª·¢ÈËÔ±¾¡¿ìÁ˽âÕâЩ±ä»¯£¬ÎÒÃÇÕë¶Ô 2007 Äê 6 Ô CTP °æ±¾µÄ SQL Server 2008 ÖÐµÄ T-SQL ÓïÑÔµÄÐÂÔö¹¦ÄܽøÐÐÁË·ÖÎöºÍ³¢ÊÔ¡£±¾ÎÄÃèÊö×Ô SQL Server 2008 CTP1 ÒÔÀ´ÕâЩÓïÑÔÔöÇ¿ºÍ±ä»¯¡£
¡¡¡¡±¾ÎÄ°üº¬ÈçÏÂÄÚÈÝ£º
¡¡¡¡· T-SQL Ðй¹ÔìÆ÷
¡¡¡¡· FORCESEEK ±íÌáʾ
¡¡¡¡· GROUPING SETS
¡¡¡¡· ¼æÈÝÐÔ¼¶±ð
¡¡¡¡· Óû§×Ô¶¨Òå±íÊý¾ÝÀàÐÍ
¡¡¡¡· ±íÖµ²ÎÊý
¡¡¡¡· MERGE Óï¾ä
¡¡¡¡±¾ÎÄÊÊÓÃÓÚ£ºMicrosoft)R) SQL Server(TM) 2008 Developer Edition June 2007 CTP
¡¡¡¡1¡¢T-SQL Ðй¹ÔìÆ÷
¡¡¡¡T-SQL Ðй¹ÔìÆ÷(Row Constructors)ÓÃÀ´ÔÚ INSERT Óï¾äÖÐÒ»´ÎÐÔ²åÈë¶àÐÐÊý¾Ý¡£ÀýÈ磺
CREATE TABLE #a
(
¡¡¡¡Column1 nvarchar(max),
¡¡¡¡Column2 nvarchar(max)
);
GO
INSERT INTO #a
VALUES (
('1', '1'),
('2', '2')
);
SELECT * from #a;
GO
DROP TABLE #a;
GO
¡¡¡¡¾¹ýÔöÇ¿ºóµÄ INSERT Óï¾äµÄÓï·¨½á¹¹ÈçÏ¡£
[ WITH <common_table_expression> [ ,...n ] ]
INSERT
¡¡¡¡[ TOP ( expression ) [ PERCENT ] ]
¡¡¡¡[ INTO ]
¡¡¡¡{ <object> | rowset_function_limited
¡¡¡¡¡¡[ WITH ( <Table_Hint_Limited> [ ...n ] ) ]
¡¡¡¡}
{
¡¡¡¡[ ( column_list ) ]
¡¡¡¡[ <OUTPUT Clause> ]
¡¡¡¡{ VALUES ( ( { DEFAULT | NULL | expression } [ ,...n ] ) [ ,...n ] )
¡¡¡¡| derived_table
¡¡¡¡| execute_statement
¡¡¡¡| <dml_table_source>
¡¡¡¡| DEFAULT VALUES
¡¡¡¡}
}
[; ]
<object> ::=
{
¡¡¡¡[ server_name . database_name . schema_name .
¡¡¡¡¡¡| database_name .[ schema_name ] .
¡¡¡¡¡¡| schema_name .
¡¡¡¡]
¡¡¡¡¡¡¡¡table_or_view_name
}
<dml_table_source> ::=
¡¡¡¡SELECT <select_list>
¡¡¡¡from ( <dml_statement_with_output_clause> )
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡[AS] table_alias [ ( column_alias [ ,...n ] ) ]
¡¡¡¡¡¡¡¡[ WHERE <search_condition> ]
¡¡¡¡[ OPTION ( <query_hint> [ ,...n ] ) ]
¡¡¡¡2. FORCESEEK Ìáʾ
FORCESEEK ÊÇÒ»¸öеıíÌáʾ(Table Hints)£¬ËüÓÃÀ´Ö¸¶¨ SQL Server ²éѯÓÅ»¯³ÌÐòÈçºÎ¸ü¸ßЧµÄÖ´Ðвéѯ¡£¸ÃÌáʾָʾÓÅ»¯³ÌÐò¶Ô²éѯÒýÓõıíºÍÊÓͼͨ¹ýË÷Òý¼ìË÷À´×÷ΪΨһµÄ²éѯִÐзÃÎ
Ïà¹ØÎĵµ£º
ÊÓͼ
SET¡¡NOCOUNT ON;
SET Northwind;
GO
IF OBJECT_ID('dbo.ViewName') IS NOT NULL
DROP VIEW dbo.ViewName;
GO
CREATE VIEW dbo.Viewname
AS
SELECT * from customer AS C
WHERE EXISTS
(SELECT * from dbo.Orders AS O
WHERE O.CustomerI ......
SQL Server ϵͳȫ¾Ö±äÁ¿
@@CONNECTIONS
·µ»Ø×ÔÉÏ´ÎÆô¶¯ÒÔÀ´Á¬½Ó»òÊÔͼÁ¬½ÓµÄ´ÎÊý¡£
@@CURSOR_ROWS
·µ»ØÁ¬½ÓÉÏ×îºó´ò¿ªµÄÓαêÖе±Ç°´æÔڵĺϸñÐеÄÊýÁ¿(·µ»Ø±»´ò¿ªµÄÓαêÖл¹Î´±»¶ÁÈ¡µÄÓÐЧÊý¾ÝÐеÄÐÐÊý)
@@DATEFIRST
·µ»ØÿÖܵÚÒ»ÌìµÄÊý×Ö
@@ERROR
·µ»Ø×îºóÖ´ÐеÄSQL Óï¾äµÄ´íÎó´úÂë¡£
@@FETCH_STATUS
·µ»Ø ......
Æô¶¯ÓëÅäÖòÎÊý ¸ü¸ÄϵͳԪÊý¾ÝºÍ²ÎÊýÅäÖà ¶¯Ì¬ÊÓͼ ´æ´¢µÄÎïÀíºÍÂß¼½á¹¹ Æô¶¯ºÍ¹Ø±Õ
topÆô¶¯ÓëÅäÖòÎÊý
ÔÚSQL Server°²×°µÄʱºò£¬Í¬Ê±Ò²»áÍùWindows×¢²á±íÀïÃæÌí¼ÓһЩ¼Ç¼£¬ÕâЩע²á±í¼üÖµÖ¸¶¨ÁËʵÀýËùÐèÒªµÄ¸÷ÖÖ²ÎÊý¡£±ÈÈ磬ÓеÄ×¢²á±í¼üÖµÖ¸¶¨ÁË´íÎóÈÕÖ¾µÄ±£´æĿ¼£¬ÁíÍâµÄÖ¸¶¨ÁËĬÈϵı¸·ÝĿ¼µÈµÈ¡£SQL ServerÔÚÔ ......
¡¡¡¡1. SQL ServerµÄϵͳ±í
¡¡¡¡MicrosoftµÄSQL ServerÊÇÒ»¸ö¿ÉÉìËõµÄ¸ßÐÔÄÜÊý¾Ý¿â¹ÜÀíϵͳ£¬×¨Îª·Ö²¼Ê½¿Í»§»ú/·þ
ÎñÆ÷»·¾³¶øÉè¼Æ£¬SQL Server¼¸ºõ½«ËùÓеÄÅäÖÃÐÅÏ¢¡¢°²È«ÐÔÐÅÏ¢ºÍ¶ÔÏóÐÅÏ¢¶¼´æ´¢ÔÚÁËËü×Ô
ÉíµÄϵͳ±íÖУ¬¶øϵͳ±í´æÔÚÓÚÿ¸ö¶ÀÁ¢µÄÊý¾Ý¿âÖУ¬´æ´¢Ò»¸öÌض¨Êý¾Ý¿â¶ÔÏóÐÅÏ¢µÄϵͳ±í
ͨ³£³ÆΪÊý¾Ý¿âĿ¼£¬M ......
sql Ìí¼ÓзÖÇø
ALTER PARTITION SCHEME SCH_Source_ID_DT_ID
NEXT USED sn3
go
ALTER PARTITION FUNCTION [PF_Source_ID_DT_ID]()
SPLIT RANGE ('350000')
ɾ³ý·ÖÇø
±à¼
ALTER PARTITION FUNCTION [PF_Source_ID_DT_ID]( ......