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

SQL»ù´¡ÎÊÌâÕûÀí(1)——Äã´ð¶ÔÁ˶àÉÙ£¿

ÔÚ³ÌÐòÖУ¬Êý¾Ý¿â²Ù×÷ÊDZز»¿ÉÉٵIJ¿·Ö£¬ËùÒÔÎÒÃÇÒª±¸×ãÊý¾Ý¿âÏà¹Ø֪ʶ²ÅÄÜÈ¥Ó¦¸¶³ÌÐòÖгöÏÖµÄÖÖÖÖÎÊÌâ¡£»ùÓÚ´Ë£¬ÎÒÌصØÔÚ¹úÍâÍøÕ¾¡¢²©¿ÍÉÏÕûÀíÁËһЩÎÊÌ⣬²¢¸½´øÁ˴𰸺ͽâÊÍ¡¢²Î¿¼¡£ÎªÁ˱£Ö¤“ԭ֭ԭ攣¬ÎҾͱ£ÁôÁËÓ¢ÎÄ¡£´ó¼ÒÒ²À´¿´¿´Äã´ð¶ÔÁ˶àÉÙ£¿
1.SQL Server 2008 Backup
ÌâÄ¿£ºIs it possible to restore a SQL Server 2008 Enterprise Edition compressed backup to a SQL Server 2008 Standard Edition?
´ð°¸£ºyes
½âÊÍ£ºRESTORE from compressed backups on SQL Server 2008 Standard Edition is possible, although the backup compression feature is not supported in SQL Server 2008 Standard Edition.
²Î¿¼£º±¸·ÝѹËõ (SQL Server)
2.Identity
ÌâÄ¿£ºWe want to insert record into table a
create table a (a int identity(1,1))
Which statement will work?
insert into a default values
insert into a values (default)
insert into a values (1)
could not insert explicit for identity column
´ð°¸£ºinsert into a default values
½âÊÍ£ºAn insert statement with "default values" works.
²Î¿¼£ºINSERT
3.Dynamic SQL
ÌâÄ¿£ºSam has to run a query dynamically & get the count in a variable and do some processing based on the count. Which of the following queries will return expected output?
declare @tablevariable varchar(100)
set @tablevariable = 'Employees'
A)
declare @sql varchar(100)
Declare @cnt int
Set @sql = 'Select ' + Convert(varchar(100),@cnt) + ' =count(*) from ' + @tablevariable
Exec (@sql) select @cnt
B)
declare @sql varchar(100)
Declare @cnt int
Set @sql = 'Select count(*) from ' + @tablevariable
@cnt = Exec (@sql) select @cnt
C)
DECLARE @sql nvarchar(4000), @params nvarchar(4000), @count int
SELECT @sql = N' SELECT @cnt = COUNT(*) from dbo.' + quotename(@tablevariable)
SELECT @params = N'@cnt int OUTPUT'
EXEC sp_executesql @sql, @params, @cnt = @count OUTPUT select @count
´ð°¸£ºC
½âÊÍ£ºFor getting a variable as output in a dynamic statement, we need to use sp_executeSQL.
²Î¿¼£ºIntroducing Dynamic SQL
4.T-SQL Output Clause
ÌâÄ¿£ºExecuting the


Ïà¹ØÎĵµ£º

¡¾×ª¡¿ ¹ØÓÚPL/SQLÖжԴ洢¹ý³Ìadd debug information

¹ØÓÚPL/SQLÖжԴ洢¹ý³Ìadd debug information
http://space.itpub.net/13129975/viewspace-626245
 
Èç¹ûʹÓÃPL/SQL DeveloperÖÐÑ¡ÔñÒ»¸ö´æ´¢¹ý³Ìdebugµ«ÓÖdebug²»½øÈ¥£¡
½â¾öÕâ¸öÎÊÌâÊǺܼòµ¥µÄ£¬Ö»ÐèÒªÔÚPL/SQL DeveloperÖÐÑ¡ÔñÒªdebugµÄ´æ´¢¹ý³Ì£¬È»ºóµãÓÒ¼ü£¬ÔÚµ¯³öµÄ²Ëµ¥ÖÐÑ¡Ôñ"Add debug information"ºóÔÙÖ ......

SQLÖ´ÐÐ˳Ðò

Ò»¡¢sqlÓï¾äµÄÖ´Ðв½Ö裺
1£©Óï·¨·ÖÎö£¬·ÖÎöÓï¾äµÄÓï·¨ÊÇ·ñ·ûºÏ¹æ·¶£¬ºâÁ¿Óï¾äÖи÷±í´ïʽµÄÒâÒå¡£
2£© ÓïÒå·ÖÎö£¬¼ì²éÓï¾äÖÐÉæ¼°µÄËùÓÐÊý¾Ý¿â¶ÔÏóÊÇ·ñ´æÔÚ£¬ÇÒÓû§ÓÐÏàÓ¦µÄȨÏÞ¡£
3£©ÊÓͼת»»£¬½«Éæ¼°ÊÓͼµÄ²éѯÓï¾äת»»ÎªÏàÓ¦µÄ¶Ô»ù±í²éѯÓï¾ä¡£
4£©±í´ïʽת»»£¬ ½«¸´Ô SQL ±í´ïʽת»»Îª½Ï¼òµ¥µÄµÈЧÁ¬½Ó±í´ïʽ ......

°²×°Oracle 10g inistant clientºóÊÇPL/SQL³öÏÖÂÒÂë

ÏëʹÓÃPL/SQL¿ª·¢¹¤¾ß£¬µ«²»Ïë°²×°ÄǸö¼¸°ÙÕ×µÄoracle¿Í»§¶Ë£¬ÓÚÊÇ°²×°ÁËoracle 10g inistant client£¬40¶àM°É¡£
°²×°ºóPL/SQL¿ÉÒÔÓÃÁË£¬µ«ÊDzéѯ³ö¼Ç¼ÀïÃæµÄÖÐÎÄÈ´ÊÇÂÒÂë¡£ÕÛÌÚÁ˺þòÅÕÒ³ö½â¾ö·½·¨£º
ÉèÖû·¾³±äÁ¿£ºNLS_LANG£¬ÖµÎªOracleÊý¾Ý¿âÉèÖõÄ×Ö·û¼¯£¬ÔÚÎÒµÄϵͳÀïÃæÉèÖÃÊÇ£ºSIMPLIFIED CHINESE_CHINA.ZHS16GBK ......

SQLʱ¼ä¸ñʽת»»´óÈ«

                                                   ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ