ÈçºÎÓÐЧµÄ·ÀÖ¹SQLÁ¬½Ó×Ö·û´®×¢Èë
¸ÅÄÔÚ±àд°²È«´úÂëʱ£¬×îÖØÒªµÄ¹æÔòÖ®Ò»¾ÍÊÇ“¾ø¶Ô²»ÒªÃ¤Ä¿µÄÏàÐÅÓû§µÄÊäÈ딡£
ÀûÓÃADO.NET 2.0µÄSqlConnectionStringBuilderÀàÉú³ÉÊý¾Ý¿âÁ¬½Ó×Ö·û´®£¬Ëü¿ÉÒÔÓÐЧµÄ·ÀÖ¹“SQLÁ¬½Ó×Ö·û´®¶ñÒâ×¢È딣¬ÒòΪÕâ¸öÀàÊÇרÃÅΪSQL SERVERÉè¼ÆµÄËùÒÔ£»Ëü¼æÈݾÉʽ¹Ø¼ü×Ö¡£¹ØÓÚÈçºÎʹÓÃSqlConnectionStringBuilderÀ࣬Çë²Î¿¼ÎÒÒÔǰдµÄһƪ“ÖÇÄÜÊý¾Ý¿âÁ¬½ÓÉú³ÉÆ÷”ÎÄÕÂÀï¡£
·ÀÖ¹SQLÊý¾Ý¿âÁ¬½Ó×Ö·û´®Ê¾Àý
C#ºǫ́ʾÀý´úÂ룺
SqlConnectionStringBuilder bldr = new SqlConnectionStringBuilder();
bldr.DataSource = @".\SQLExpress";
bldr.InitialCatalog = "Pubs";
bldr.UserID = textBox1.Text;
bldr.Password = textBox2.Text;
¸Õ²Å¿´µ½Ç°Ì¨Óû§ÔÚÓû§ÃûÊäÈëµÄÓû§Ãû×Ö·û´®£¬¾ÍÊǶñÒâSQL×¢È룬¶øSqlConnectionStringBuilder»á°Ñ
“Óû§Ãû£»Data Source=Northwind”µÄ×Ö·û´®×÷Ϊ“UesrID”À´µÇ¼Êý¾Ý¿â¡£Õâ¾Í·ÀÖ¹¶ñÒâµÄ×¢ÈëÁË¡£
×îºóÏ£ÍûÄܺÍ־ͬµÀºÏµÄ¿ª·¢Í¬Ö¾£¬Ò»Æðѧϰ£¬Ò»Æð·ÖÏí¡£Ð»Ð»
ÍƼöÁ´½Ó:»ÝÆÕºÚ°×¼¤¹â´òÓ¡»ú/°®ÆÕÉúÕëʽ´òÓ¡»ú
Ïà¹ØÎĵµ£º
1 :ÆÕͨSQLÓï¾ä¿ÉÒÔÓÃexecÖ´ÐÐ
Select * from tableName
exec('select * from tableName')
exec sp_executesql N'select * from tableName' -- Çë×¢Òâ×Ö·û´®Ç°Ò»¶¨Òª¼ÓN
2:×Ö¶ÎÃû£¬±íÃû£¬Êý¾Ý¿âÃûÖ®Àà×÷Ϊ±äÁ¿Ê±£¬±ØÐëÓö¯Ì¬SQL
declare @fname varchar(20)
set @fname = 'FiledName'
Select @fname from tab ......
sp_databases --Áгö·þÎñÆ÷ÉϵÄËùÓÐÊý¾Ý¿â
sp_server_info --Áгö·þÎñÆ÷ÐÅÏ¢£¬Èç×Ö·û¼¯£¬°æ±¾ºÍÅÅÁÐ˳Ðò
sp_stored_procedures--Áгöµ±Ç°»·¾³ÖеÄËùÓд洢¹ý³Ì
sp_tables --Áгöµ±Ç°»·¾³ÖÐËùÓпÉÒÔ²éѯµÄ¶ÔÏó
sp_start_job --Á¢¼´Æô¶¯×Ô¶¯»¯ÈÎÎñ
sp_stop_job --Í£Ö¹ÕýÔÚÖ´ÐеÄ×Ô¶¯»¯ÈÎÎñ
sp_password --Ì ......
Maximizing SQL*Loader Performance
SQL*Loader is flexible and offers many options that should be considered to maximize the speed of data loads. These include:
¡ñ Use Direct Path Loads - The conventional path loader essentially loads the data by usin ......
Ó¦ÓÃʾÀý£º
-- ´´½¨2¸ö²âÊÔ±í
CREATE TABLE [dbo].[Table_2019]([Data] [nchar](2019) NOT NULL)
CREATE TABLE [dbo].[Table_2020]([Data] [nchar](2020) NOT NULL)
go
-- Ìî³äÊý¾Ý
declare @i int
set @i = 0
while(@i < 20)
begin
insert Table_2019(Data) values('')
  ......
sql serverµÄ money ÀàÐÍÆäʵ¾ÍÊÇСÊýÀàÐÍ decimal £¬ÎÒ²»Ï²»¶ÓÃËü£¬ÒòΪÓÐÒ»´Îʲô¹¤¾ßÉú³É£¬·¢ÏÖËü×Ô¶¯°ÑmoneyÀàÐÍת»»³ÉÁËdecimalÀàÐÍÁË£¬ÓëÆäÈÃËüת£¬»¹²»Èç×Ô¼ºÉè¼ÆÊý¾Ý¿âʱ½«»õ±ÒÀàÐÍ×Ö¶ÎÉèÖÃΪ decimal ÀàÐͲ»¾ÍµÃÁË£¬·ÏÄÇʸÉÂ ×Ö½ÚÊý ³¤¶È(СÊýµãÇ°.СÊýµãºó) ......