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
Ïà¹ØÎĵµ£º
ϵͳ»·¾³£ºWindows 7
Èí¼þ»·¾³£ºVisual C++ 2008 SP1 +SQL Server 2005
±¾´ÎÄ¿µÄ£º±àдһ¸öº½¿Õ¹ÜÀíϵͳ
ÕâÊÇÊý¾Ý¿â¿Î³ÌÉè¼ÆµÄ³É¹û£¬ËäÈ»³É¼¨²»¼Ñ£¬µ«ÊÇ×÷ΪÎÒÓÃVC++ ÒÔÀ´±àдµÄ×î´ó³ÌÐò»¹ÊÇ´«µ½ÍøÉÏ£¬ÒÔ¹©²Î¿¼¡£ÓÃVC++ ×öÊý¾Ý¿âÉè¼Æ²¢²»ÈÝÒ×£¬µ«Ò²²»ÊDz»¿ÉÄÜ¡£ÒÔÏÂÊÇÎҵijÌÐò½çÃ棬ºóÃæ ......
¹ØÓÚPL/SQLÖжԴ洢¹ý³Ìadd debug information
http://space.itpub.net/13129975/viewspace-626245
Èç¹ûʹÓÃPL/SQL DeveloperÖÐÑ¡ÔñÒ»¸ö´æ´¢¹ý³Ìdebugµ«ÓÖdebug²»½øÈ¥£¡
½â¾öÕâ¸öÎÊÌâÊǺܼòµ¥µÄ£¬Ö»ÐèÒªÔÚPL/SQL DeveloperÖÐÑ¡ÔñÒªdebugµÄ´æ´¢¹ý³Ì£¬È»ºóµãÓÒ¼ü£¬ÔÚµ¯³öµÄ²Ëµ¥ÖÐÑ¡Ôñ"Add debug information"ºóÔÙÖ ......
Èç¹û±íÖдæ·ÅµÄÊý¾ÝÊÇÊ÷Ðνṹ£¬µ±ÖªµÀijһ¸ö½ÚµãµÄֵʱ£¬Í¬Ê±ÏëÈ¡µÃËüËùÓÐ×Ó½ÚµãµÄÊý¾Ý¡£
±í½á¹¹£º
±íÖдæ·ÅµÄÊDz¿ÃÅ×éÖ¯½á¹¹£¬ BMN_CD²¿ÃÅ£¬SSK_KAISO_LVÊǽײ㣬BMN_MKJ²¿ÃÅÃû³Æ£¬JOI_KAISO_LVÉÏ ......