| 订阅 | 在线投稿
分享
 
 
当前位置: 王朝网络 >> mssql >> SQL Server kai fa guo cheng zhong de de chang jian wen ti zong jie
 

SQL Server kai fa guo cheng zhong de de chang jian wen ti zong jie

2008-07-19 08:21:48 编辑來源:互联网 评论
 
本文为【SQL Server开发过程中的的常见问题总结】的拼音翻译版
  zai SQL Server kai fa wen ti zhong ni ke neng hui wen dao de shi ge wen ti :
  1、 shen me shi chang jian de dui biao he zi duan de ming zi yue shu ?
  2、 you mei you ke neng zai bu le jie T-SQL de qing kuang xia bian xie cun chu guo cheng ?
  3、T-SQL zhong ru he bi jiao CLR cun chu guo cheng he han shu de xing neng ?
  4、 wo ru he zai yi ge cun chu guo cheng zhong shi yong ling yi ge cun chu guo cheng chan sheng de jie guo ?
  5、 wo ru he jie jue SQL Server 2005 de bing fa wen ti ?
  6、 zai SQL Server 2005 zhong yong shen me gong ju ti dai le cha xun fen xi qi ?
  7、 ni neng ti gong yi xie you guan SQL he T-SQL de xiang xi xin xi ma ?
  8、SQL Server 2005 you mei you xin de suo yin lei xing ?
  9、 wo ru he chuang jian yi ge jiao ben zai biao zhong jin xing xuan ze ?
  10、 wo ru he lie chu na xie mei you ji lu de shu ju ku biao ?
  dui yu biao he zi duan de chang jian ming zi yue shu
  hui da :
  SQL Server 2000 xia de biao he zi duan ming cheng you 1 dao 128 zi jie de xian zhi , bing qie zun xun yong yu biao shi de gui ze 。
  di yi ge zi mu bi xu shi ru xia de yi zhong :
  · Unicode Standard 2.0 zhong gui ding de zi mu 。
  Unicode dui zi mu de ding yi bao kuo : la ding zi mu , cong A dao Z, chu le lai zi qi ta yu yan de zi mu zhi wai 。
  · xia hua xian (_),at fu hao (@), huo zhe shu zi fu hao (#)
  zai SQL Server zhong yi zhe xie fu hao zuo wei biao shi fu de kai shi ju you te shu de han yi 。 yi ge yi at fu hao (@) kai tou de biao shi fu biao shi yi ge ben di de bian liang huo zhe shen shu 。 yi ge yi shu zi fu hao (#) kai tou de biao shi fu dai biao yi ge lin shi biao huo zhe guo cheng 。 yi ge yi liang ge shu zi fu hao (##) kai tou de biao shi fu biao shi de shi yi ge quan ju lin shi dui xiang 。
  yi xie Transact-SQL han shu de ming zi yi liang ge at fu hao (@@) kai tou 。 wei le bi mian yu zhe xie han shu hun xiao , tui jian ni bu yao shi yong liang ge at fu hao (@@) kai tou de biao shi fu 。
  jie xia lai de zi mu ke yi shi yi xia de ren yi ji zhong :
  · Unicode Standard 2.0 ding yi de zi mu
  · lai zi ji chu la ding wen huo zhe qi ta yu yin de shi jin zhi shu zi
  · at fu hao (@), mei yuan fu hao ($), shu zi fu hao (#), huo zhe xia hua xian
  biao shi fu jue dui bu neng shi Transact-SQL de bao liu zi 。SQL Server bao liu le yi xie da xie he xiao xie de bao liu zi 。 nei jian de kong jian huo zhe te shu de zi mu dou bu yuan xu chu xian , jin guan ni ke yi zai hao de lao ban ben de Northwind zhong kan dao ta men bao han le nei jian de kong jian 。 ni bi xu tong guo ba ta men kuo zai kuo hao zhong cai ke yi fang wen 。
  bu ju you ren he T-SQL zhi shi de qing kuang xia bian xie SQL Server2005 cun chu guo cheng ma ?
  xu duo cheng xu yuan dou ren wei chuang jian SQL Server cun chu guo cheng bu zai bi xu T-SQL le 。 bu xing de shi ( huo zhe bing fei ru ci , zhe gen ju ni de guan dian ), zhe bing bu quan shi shi shi 。 zai ji shu shang shi ke yi zai bu le jie T-SQL de qing kuang xia chuang jian cun chu guo cheng de , dan shi mei you T-SQL de hua ze wu fa fang wen ren he de shu ju 。
  zai CLR cun chu guo cheng nei bu jin xing shu ju fang wen , shi tong guo shi yong biao zhun de ADO.NET lei lai wan cheng de 。 kai fa ren yuan hui zai ying yong cheng xu ceng fa xian hen duo tong yang de mei you yong chu de shu ju fang wen dai ma , zhe xie dai ma hui hen qing yi di zhuan yi dao SQLCLR li cheng zhong qu 。 dang zhong jian ceng de zhe xie ADO.NET lei xu yao shi yong T-SQL lai fang wen shu ju de shi hou , zai CLR zhu ji ti gong de huan jing zhong jiu hui shi yong tong yang de lei 。
  wo yao qiang tiao de shi , cong ji shu jiao du lai shuo , bu shi yong T-SQL lai bian xie cun chu guo cheng shi ke neng de 。 na me you mei you li you zhe me zuo ne ? yi zhong qing kuang jiu shi zhe shi yi ge yong lai cong pu tong wen jian huo zhe wang luo fu wu zhong jian suo shu ju de CLR cun chu guo cheng , bing jiang shu ju ge shi she zhi wei xing ji 。 zhe li ke neng jiu hui yong dao bu xu yao T-SQL de cao zuo —— dan shi zhe bing bu shi dui T -SQL cun chu guo cheng neng li de yi ge hen hao de bi yu 。
  CLR cun chu guo cheng vs. T-SQL cun chu guo cheng
  CLR cun chu guo cheng he han shu yu T-SQL cun chu guo cheng he han shu xiang bi , xing neng ru he ?
  hui da :
  zhe li shi yong lai bi jiao T-SQL li cheng he CLR li cheng xing neng de yi zhong chang yong de gui ze : yong ni de shu ju , zai ni de fu wu qi shang , ce shi liang tao pei zhi , kan kan na yi ge bi jiao hao 。
  jiu shi shuo , xu duo ren dou yun xing guo xing neng ce shi , yi ban de jie guo jiu shi T-SQL zai biao zhun de CRUD( chuang jian 、 du qu 、 geng xin 、 shan chu ) cao zuo shang biao xian yao bi hao yi dian , er zai fu duo shu xue 、 zi fu chuan fu zhi he qi ta de chao guo shu ju fang wen de ren wu shang , ze shi CLR de xing neng biao xian geng hao yi dian 。
  SQL Server de zhuan jia Gustavo Larriera bian ji le ru xia yi xie guan yu zhe ge zhu ti de you yong lian jie :
  · zai SQL Server 2005 zhong shi yong CLR Integration。
  · jian dan jie shao zai SQL Server 2005 zhong de CLR Integration。
  · zai SQL Server 2005 zhong dui CLR he T-SQL zuo chu xuan ze 。
  · jie shao SQL Server 2005 zhong de CLR Integration。
  ·SQL Server xian tan : SQL Server 2005 Beta 2 CLR wen ti yu hui da 。
  · shu ju ku guan li yuan de fang yu .NET。
  · yong hu zi ding yi han shu de xing neng bi jiao 。
  ru he zai yi ge cun chu guo cheng zhong shi yong ling yi ge cun chu guo cheng de jie guo ?
  zhuan jia hui da :
  zhi yao cun chu guo cheng zhi chan sheng le yi ge dan ge de jie guo , yao zai ling wai yi ge cun chu guo cheng zhong shi yong zhe ge cun chu guo cheng chan sheng de shu chu , zhe ge ji shu shi fei chang zhi jie de 。 zhe ge ji shu jiu shi shi yong yi ge lin shi biao lai zhuang zai cun chu guo cheng de ju e iguo, ran hou tong guo INSERT EXEC yu ju lai zhi xing zhe ge guo cheng bing bao cun jie guo 。 yi dan jie guo bao liu zai lin shi biao zhong le , ta men jiu ke yi xiang shi yong qi ta biao shu ju yi yang lai shi yong ta le 。
  zhe li shi wo men ke neng hui fu yong de yi ge guo cheng li zi :
  CREATE PROC usp_Demo_AllAuthors as
  select * from pubs..authors
  GO
  xian zai you yi ge cun chu guo cheng shi yong usp_Demo_AllAuthors de jie guo :
  CREATE proc usp_Demo_SPUser as CREATE TABLE #Authors (
  au_id varchar(11) NOT NULL PRIMARY KEY CLUSTERED,
  au_lname varchar (40) NOT NULL ,
  au_fname varchar (20) NOT NULL ,
  phone char (12) NOT NULL,
  address varchar (40) NULL ,
  city varchar (20) NULL ,
  state char (2) NULL ,
  zip char (5) NULL ,
  contract bit NOT NULL
  )– Execute usp_Demo_AllAuthors storing the
  – results in #Authors
  insert into #Authors
  exec usp_Demo_AllAuthors– Here we use the #Authors table. This example only
  – only selects from the temp table but you could do much
  – more such as use a cursor on the table or join with
  – other data.
  SELECT au_fName + ‘ ‘ + au_lname as [name]
  , address+’, ‘+city+’, ‘+state+’ ‘+zip [Addr]
  from #AuthorsDROP TABLE #Authors
  GO
  SQL Server 2005 zhong de cun chu guo cheng bing fa wen ti
  wo zai SQL Server2005 zhong yu dao le bing fa wen ti 。 wo chi you che piao de gong gong qi che shang you yi xie kong xian de zuo wei 。 wo zai cha ru xiao shou de cha piao zhi qian , xu yao cha kan shi fou huan you kong xian de zuo wei 。 wo de cun chu guo cheng zuo de shi qing ru xia suo shi :
  CREATE PROCEDURE add_ticket — parameters
  DECLARE free_seats int BEGIN TRANSACTION SELECT free_seats
  = COUNT(*) FROM tickets WHERE seat_is_not_taken IF free_seats
  <> 0 INSERT INTO tickets VALUES(…) — some other statements END TRANSACTION
  wen ti jiu shi liang ge guo cheng ke yi tong shi du qu kong xian piao shu , bing qie dou ke yi yu yue yi zhang piao , ji shi shi na li yi jing mei you kong yu de le 。 wo xu yao yi zhong fang fa lai fang zhi yi ge guo cheng zai ling yi ge guo cheng yun xing add_ticket cheng xu , dan shi huan mei you cha ru yi zhang xin piao de shi hou du qu kong piao de shu liang 。
  hui da :
  ni shi zheng que de ; geng gao de ge li ji bie ye bu hui bao zheng duo ge du zhe qu tong shi qu du qu tong yi ge shu ju xing 。 ran er , huan you ji zhong fang fa ni ke yi wan cheng zhe xiang gong zuo 。 li ru , ni ke yi gei mei ge zuo wei fen pei yi ge wei yi de biao shi fu ( yi si shi , wei yi jian —— bu yi ding shi GUID), bing qie chuang jian yi ge miao shu na xie zuo wei yi jing bei yu ding le de biao 。 zai biao shang fang yi ge UNIQUE yue shu , ni jiu ke yi que bao tong yi ge zuo wei bu hui bei cha ru liang ci le 。
  jiu shi shuo , wo ren wei yi ge geng you qu de fang fa jiu shi shi yong SQL Service Broker。 ni ke yi wei mei ge gong jiao jian li yi ge hui hua , bing qie jiang zhe ge hui hua de ju bing cun fang zai yi ge biao zhong , du zhe zai zhi xing RECEIVE zhi qian ke yi shen kao zhe ge biao 。 tong guo zhe zhong fang shi , du zhe jiu ke yi zheng que di guo lv 。 gong gong qi che shang de mei ge zuo wei dou cha yi ge xiao xi dao dui lie zhong 。 du zhe jiu ke yi jian dan di RECEIVE dao suo xu de xiao xi ( zai zhe ge guo cheng zhong , yu ding gong gong qi che shang de zuo wei )。 Service Broker hui que bao mei you xiao xi hui bei jie shou liang ci , ye jiu shi shuo ni bu hui zai yu dao bing fa wen ti le 。
  SQL Server 2005 zhong qu dai le cha xun fen xi qi
  hui da :
  ni shi dui de 。 cha xun fen xi qi he qi ye guan li qi dou cong SQL Server zhong shan chu le 。 qu dai ta men de shi yi ge gong ju ,SQL Server guan li tao jian (SQL Server Management Studio)。 zhe ge gong ju ju you qian ren de da duo shu te xing , dan shi yong you sheng ji hou de yong hu jie mian he hen duo jing guo gai shan de gong neng 。 wo jiao de da duo shu de shu ju ku guan li yuan dou hui fa xian zhe shi yi ge hen hao de sheng ji 。
  ru guo ni xiang yao le jie geng duo you guan SQL Server guan li tao jian de xin te xing de xin xi , qing yue du SearchSQLServer.com shang you guan zhe ge hua ti de wen zhang 。
  SQL vs. T-SQL
  hui da :
  SQL shi jie gou hua cha xun yu yan , shi ANSI/ISO ren ke de biao zhun shu ju ku yu yan 。SQL Server de shi xian yu yan jiao zuo Transact-SQL (T-SQL)。T-SQL ji ben shang shi gen ju 1992 nian fa biao de ISO biao zhun chu xian de , zai 1999 nian de biao zhun shang shao jia xiu gai 。 ci wai , wei ruan huan jin xing le ge zhong si you de jia qiang 。
  biao zhun SQL he T-SQL zhi jian you hen duo qu bie —— tai duo le , zhe li jiu bu shuo le 。 huan you , ru guo ni zai SQL Server shang gong zuo , na me shi yong zhe xie si you de kuo zhan shi you hao chu de 。 you yu xu duo SQL Server de te xing de ben zhi , ni bu shi yong fei biao zhun de ming ling de hua , jiang hui you hen duo qiang da de gong neng wu fa shi xian 。 ru guo ni xiang yao kan kan ni de SQL shi fou fu he biao zhun , ni ke yi shi yong SET FIPS_FLAGGER ming ling 。
  SQL Server 2005 zhong shi fou you xin de suo yin lei bie le ?
  hui da :
  SQL Server 2005 mei you wei guan xi biao yin ru xin de suo yin lei xing 。 ji ben shang —— ju cu he fei ju cu suo yin shi yi B-trees de fang shi shi xian de —— huan reng ran zai ying yong 。 ran er ,SQL Server 2005 que shi bao han le yi xie suo yin shang de jia qiang , bu lun shi wan quan wen ben suo yin , huan shi dui yu XML shu ju , ci wai zhe xie jia qiang huan ke yi gai shan yi xie yu guan xi xing suo yin you guan de wen ti 。
  SQL Server 2005 de wan quan wen ben suo yin te xing shi quan xin de , bing qie shi chong xin bian xie de 。 yao huo de zhe ge te xing de xin xi , qing yue du Nimish Khanolkar de MSDN guang bo wen dang , jie shao SQL Server 2005 zhong de quan wen ben cha zhao 。
  XML shi SQL Server 2005 zhong ling wai yi ge zai fang shi shang fa sheng le ju da zhuan bian de nei rong 。 xian zai dui yu kai fa ren yuan lai shuo you di yi liu de XML shu ju lei xing ke yong le 。 zhe ge lei xing zhi chi XQuery cha xun yu yan , shi yong le zhe ge lei xing de zi duan ke yi tong guo te shu ge shi de XML suo yin bei suo yin dao 。 yao le jie geng duo you guan XML lei xing de xin xi , qing cha zhao MSDN shang de wen zhang 。
  huan you ge zhong ge yang de you guan T-SQL suo yin ming ling de jia qiang 。 ye xu zui ling ren gan xing qu de jiu shi xin de “ zai xian ” suo yin lei xing , ta yuan xu shu ju ku guan li yuan zai bu xu yao ba yong hu suo dao biao wai mian de qing kuang xia zhi xing suo yin wei hu ren wu 。 zhe ge hen you ke neng biao ji zhe shu ju ku guan li yuan xu yao deng dao ye li 3 dian cai neng da kai wei hu chuang kou xiu zheng wen ti de zhuang kuang de zhong jie ! yao le jie geng duo you guan zhe ge te xing de xin xi , qing cha zhao SQL Server Worldwide Users Group shang de wen zhang 。
  wei xing xuan ze chuang jian yi ge jiao ben
  xiang xiang yi xia zhe ge biao :
  prod_key item_key pack_key last_sale
  LM001 1029 AD100 2004/12/05
  LM870 1029 AD100 2005/09/20
  PE789 1030 BC400 2003/07/12
  PE312 1030 BC400 2004/08/07
  wo xiang yao xuan chu na xie zai item_key he pack_key xiang deng de qing kuang xia , ri qi bi jiao da de na yi xing 。 huan ju hua shuo , wo xiang yao :
  LM870 1029 AD100 2005/09/20
  PE312 1030 BC400 2004/08/07
  hui da :
  zhe ge biao you zhu jian ma ? na yang de hua cha xun ke neng hui rong yi xie 。 bu guan zen me yang , wo jiao de ni ying gai an zhao xia mian zhe yang :
  SELECT prod_key,item_key,pack_key,last_sale
  FROM (SELECT item_key,pack_key,MAX(last_sale)
  AS last_sale FROM tablex GROUP BY item_key,pack_key) AS MaxDateTable
  WHERE tablex.item_key = MaxDateTable.item_key
  AND tablex.pack_key = MaxDateTable.pack_key
  AND tablex.last_sale = MaxDateTable.last_sale
  lie chu mei you ji lu de shu ju ku biao
  wo chuang jian le yi ge dong tai de SQL Server cha xun lai shu chu biao zhong xing de shu liang 。 wo de mu biao shi lie chu zai shu ju ku zhong mei you ji lu de biao 。 cha xun ru xia suo shi :
  declare @strsql varchar(100)
  declare @tablename varchar(50)
  @tablename=’table123′@strsql=’
  select count(*) from ‘ + @tablename exec(@strsql)
  wo de dao le shu chu , dan shi wo wu fa ba zhe ge zhi cun chu dao bian liang zhong yi bei cha kan 。
  B<> wo xiang yao zhe yang cha kan :
  /* @countvariable=0
  print(@tablename)*/
  huan you qi ta de jie jue fang fa ma ?
  hui da :
  ni ke yi rang ni de jie jue fang an geng jia ling huo yi xie , tong guo cong sysobjects biao zhong zhua qu biao ming :
  declare @strsql varchar(256)
  create table #emptytables
  (tablename varchar(128), table_rowcount int)select
  @strsql=’select distinct o.name as TableName,
  .rowcnt as Table_RowCount
  from sysobjects o
  inner join sysindexes x
  on o.id = x.id
  where x.rowcnt = 0 and
  o.type = ‘’U”’insert #emptytables (TableName,
  Table_rowcount) exec (@strsql)
  select * from #emptytables
  drop table #emptytables【原文】【汉音对照
 
 
 
 
 
 
 
 
日版宠物情人插曲《Winding Road》歌词

日版宠物情人2017的插曲,很带节奏感,日语的,女生唱的。 最后听见是在第8集的时候女主手割伤了,然后男主用嘴帮她吸了一下,插曲就出来了。 歌手:Def...

兄弟共妻,我成了他们夜里的美食

老钟家的两个儿子很特别,就是跟其他的人不太一样,魔一般的执着。兄弟俩都到了要结婚的年龄了,不管自家老爹怎么磨破嘴皮子,兄弟俩说不娶就不娶,老父母为兄弟两操碎了心...

如何磨出破洞牛仔裤?牛仔裤怎么剪破洞?

把牛仔裤磨出有线的破洞 1、具体工具就是磨脚石,下面垫一个硬物,然后用磨脚石一直磨一直磨,到把那块磨薄了,用手撕开就好了。出来的洞啊很自然的。需要猫须的话调几...

我就是扫描下图得到了敬业福和爱国福

先来看下敬业福和爱国福 今年春节,支付宝再次推出了“五福红包”活动,表示要“把欠大家的敬业福都还给大家”。 今天该活动正式启动,和去年一样,需要收集“五福”...

冰箱异味产生的原因和臭味去除的方法

有时候我们打开冰箱就会闻到一股异味,冰箱里的这种异味是因为一些物质发出的气味的混合体,闻起来让人恶心。 产生这些异味的主要原因有以下几点。 1、很多人有这种习...

 
 
zai SQL Server kai fa wen ti zhong ni ke neng hui wen dao de shi ge wen ti : 1、 shen me shi chang jian de dui biao he zi duan de ming zi yue shu ? 2、 you mei you ke neng zai bu le jie T-SQL de qing kuang xia bian xie cun chu guo cheng ? 3、T-SQL zhong ru he bi jiao CLR cun chu guo cheng he han shu de xing neng ? 4、 wo ru he zai yi ge cun chu guo cheng zhong shi yong ling yi ge cun chu guo cheng chan sheng de jie guo ? 5、 wo ru he jie jue SQL Server 2005 de bing fa wen ti ? 6、 zai SQL Server 2005 zhong yong shen me gong ju ti dai le cha xun fen xi qi ? 7、 ni neng ti gong yi xie you guan SQL he T-SQL de xiang xi xin xi ma ? 8、SQL Server 2005 you mei you xin de suo yin lei xing ? 9、 wo ru he chuang jian yi ge jiao ben zai biao zhong jin xing xuan ze ? 10、 wo ru he lie chu na xie mei you ji lu de shu ju ku biao ? dui yu biao he zi duan de chang jian ming zi yue shu hui da : SQL Server 2000 xia de biao he zi duan ming cheng you 1 dao 128 zi jie de xian zhi , bing qie zun xun yong yu biao shi de gui ze 。 di yi ge zi mu bi xu shi ru xia de yi zhong : · Unicode Standard 2.0 zhong gui ding de zi mu 。 Unicode dui zi mu de ding yi bao kuo : la ding zi mu , cong A dao Z, chu le lai zi qi ta yu yan de zi mu zhi wai 。 · xia hua xian (_),at fu hao (@), huo zhe shu zi fu hao (#) zai SQL Server zhong yi zhe xie fu hao zuo wei biao shi fu de kai shi ju you te shu de han yi 。 yi ge yi at fu hao (@) kai tou de biao shi fu biao shi yi ge ben di de bian liang huo zhe shen shu 。 yi ge yi shu zi fu hao (#) kai tou de biao shi fu dai biao yi ge lin shi biao huo zhe guo cheng 。 yi ge yi liang ge shu zi fu hao (##) kai tou de biao shi fu biao shi de shi yi ge quan ju lin shi dui xiang 。 yi xie Transact-SQL han shu de ming zi yi liang ge at fu hao (@@) kai tou 。 wei le bi mian yu zhe xie han shu hun xiao , tui jian ni bu yao shi yong liang ge at fu hao (@@) kai tou de biao shi fu 。 jie xia lai de zi mu ke yi shi yi xia de ren yi ji zhong : · Unicode Standard 2.0 ding yi de zi mu · lai zi ji chu la ding wen huo zhe qi ta yu yin de shi jin zhi shu zi · at fu hao (@), mei yuan fu hao ($), shu zi fu hao (#), huo zhe xia hua xian biao shi fu jue dui bu neng shi Transact-SQL de bao liu zi 。SQL Server bao liu le yi xie da xie he xiao xie de bao liu zi 。 nei jian de kong jian huo zhe te shu de zi mu dou bu yuan xu chu xian , jin guan ni ke yi zai hao de lao ban ben de Northwind zhong kan dao ta men bao han le nei jian de kong jian 。 ni bi xu tong guo ba ta men kuo zai kuo hao zhong cai ke yi fang wen 。 bu ju you ren he T-SQL zhi shi de qing kuang xia bian xie SQL Server2005 cun chu guo cheng ma ? xu duo cheng xu yuan dou ren wei chuang jian SQL Server cun chu guo cheng bu zai bi xu T-SQL le 。 bu xing de shi ( huo zhe bing fei ru ci , zhe gen ju ni de guan dian ), zhe bing bu quan shi shi shi 。 zai ji shu shang shi ke yi zai bu le jie T-SQL de qing kuang xia chuang jian cun chu guo cheng de , dan shi mei you T-SQL de hua ze wu fa fang wen ren he de shu ju 。 zai CLR cun chu guo cheng nei bu jin xing shu ju fang wen , shi tong guo shi yong biao zhun de ADO.NET lei lai wan cheng de 。 kai fa ren yuan hui zai ying yong cheng xu ceng fa xian hen duo tong yang de mei you yong chu de shu ju fang wen dai ma , zhe xie dai ma hui hen qing yi di zhuan yi dao SQLCLR li cheng zhong qu 。 dang zhong jian ceng de zhe xie ADO.NET lei xu yao shi yong T-SQL lai fang wen shu ju de shi hou , zai CLR zhu ji ti gong de huan jing zhong jiu hui shi yong tong yang de lei 。 wo yao qiang tiao de shi , cong ji shu jiao du lai shuo , bu shi yong T-SQL lai bian xie cun chu guo cheng shi ke neng de 。 na me you mei you li you zhe me zuo ne ? yi zhong qing kuang jiu shi zhe shi yi ge yong lai cong pu tong wen jian huo zhe wang luo fu wu zhong jian suo shu ju de CLR cun chu guo cheng , bing jiang shu ju ge shi she zhi wei xing ji 。 zhe li ke neng jiu hui yong dao bu xu yao T-SQL de cao zuo —— dan shi zhe bing bu shi dui T -SQL cun chu guo cheng neng li de yi ge hen hao de bi yu 。 CLR cun chu guo cheng vs. T-SQL cun chu guo cheng CLR cun chu guo cheng he han shu yu T-SQL cun chu guo cheng he han shu xiang bi , xing neng ru he ? hui da : zhe li shi yong lai bi jiao T-SQL li cheng he CLR li cheng xing neng de yi zhong chang yong de gui ze : yong ni de shu ju , zai ni de fu wu qi shang , ce shi liang tao pei zhi , kan kan na yi ge bi jiao hao 。 jiu shi shuo , xu duo ren dou yun xing guo xing neng ce shi , yi ban de jie guo jiu shi T-SQL zai biao zhun de CRUD( chuang jian 、 du qu 、 geng xin 、 shan chu ) cao zuo shang biao xian yao bi hao yi dian , er zai fu duo shu xue 、 zi fu chuan fu zhi he qi ta de chao guo shu ju fang wen de ren wu shang , ze shi CLR de xing neng biao xian geng hao yi dian 。 SQL Server de zhuan jia Gustavo Larriera bian ji le ru xia yi xie guan yu zhe ge zhu ti de you yong lian jie : · zai SQL Server 2005 zhong shi yong CLR Integration。 · jian dan jie shao zai SQL Server 2005 zhong de CLR Integration。 · zai SQL Server 2005 zhong dui CLR he T-SQL zuo chu xuan ze 。 · jie shao SQL Server 2005 zhong de CLR Integration。 ·SQL Server xian tan : SQL Server 2005 Beta 2 CLR wen ti yu hui da 。 · shu ju ku guan li yuan de fang yu .NET。 · yong hu zi ding yi han shu de xing neng bi jiao 。 ru he zai yi ge cun chu guo cheng zhong shi yong ling yi ge cun chu guo cheng de jie guo ? zhuan jia hui da : zhi yao cun chu guo cheng zhi chan sheng le yi ge dan ge de jie guo , yao zai ling wai yi ge cun chu guo cheng zhong shi yong zhe ge cun chu guo cheng chan sheng de shu chu , zhe ge ji shu shi fei chang zhi jie de 。 zhe ge ji shu jiu shi shi yong yi ge lin shi biao lai zhuang zai cun chu guo cheng de ju e iguo, ran hou tong guo INSERT EXEC yu ju lai zhi xing zhe ge guo cheng bing bao cun jie guo 。 yi dan jie guo bao liu zai lin shi biao zhong le , ta men jiu ke yi xiang shi yong qi ta biao shu ju yi yang lai shi yong ta le 。 zhe li shi wo men ke neng hui fu yong de yi ge guo cheng li zi : CREATE PROC usp_Demo_AllAuthors as select * from pubs..authors GO xian zai you yi ge cun chu guo cheng shi yong usp_Demo_AllAuthors de jie guo : CREATE proc usp_Demo_SPUser as CREATE TABLE #Authors ( au_id varchar(11) NOT NULL PRIMARY KEY CLUSTERED, au_lname varchar (40) NOT NULL , au_fname varchar (20) NOT NULL , phone char (12) NOT NULL, address varchar (40) NULL , city varchar (20) NULL , state char (2) NULL , zip char (5) NULL , contract bit NOT NULL )– Execute usp_Demo_AllAuthors storing the – results in #Authors insert into #Authors exec usp_Demo_AllAuthors– Here we use the #Authors table. This example only – only selects from the temp table but you could do much – more such as use a cursor on the table or join with – other data. SELECT au_fName + ‘ ‘ + au_lname as [name] , address+’, ‘+city+’, ‘+state+’ ‘+zip [Addr] from #AuthorsDROP TABLE #Authors GO SQL Server 2005 zhong de cun chu guo cheng bing fa wen ti wo zai SQL Server2005 zhong yu dao le bing fa wen ti 。 wo chi you che piao de gong gong qi che shang you yi xie kong xian de zuo wei 。 wo zai cha ru xiao shou de cha piao zhi qian , xu yao cha kan shi fou huan you kong xian de zuo wei 。 wo de cun chu guo cheng zuo de shi qing ru xia suo shi : CREATE PROCEDURE add_ticket — parameters DECLARE free_seats int BEGIN TRANSACTION SELECT free_seats = COUNT(*) FROM tickets WHERE seat_is_not_taken IF free_seats <> 0 INSERT INTO tickets VALUES(…) — some other statements END TRANSACTION wen ti jiu shi liang ge guo cheng ke yi tong shi du qu kong xian piao shu , bing qie dou ke yi yu yue yi zhang piao , ji shi shi na li yi jing mei you kong yu de le 。 wo xu yao yi zhong fang fa lai fang zhi yi ge guo cheng zai ling yi ge guo cheng yun xing add_ticket cheng xu , dan shi huan mei you cha ru yi zhang xin piao de shi hou du qu kong piao de shu liang 。 hui da : ni shi zheng que de ; geng gao de ge li ji bie ye bu hui bao zheng duo ge du zhe qu tong shi qu du qu tong yi ge shu ju xing 。 ran er , huan you ji zhong fang fa ni ke yi wan cheng zhe xiang gong zuo 。 li ru , ni ke yi gei mei ge zuo wei fen pei yi ge wei yi de biao shi fu ( yi si shi , wei yi jian —— bu yi ding shi GUID), bing qie chuang jian yi ge miao shu na xie zuo wei yi jing bei yu ding le de biao 。 zai biao shang fang yi ge UNIQUE yue shu , ni jiu ke yi que bao tong yi ge zuo wei bu hui bei cha ru liang ci le 。 jiu shi shuo , wo ren wei yi ge geng you qu de fang fa jiu shi shi yong SQL Service Broker。 ni ke yi wei mei ge gong jiao jian li yi ge hui hua , bing qie jiang zhe ge hui hua de ju bing cun fang zai yi ge biao zhong , du zhe zai zhi xing RECEIVE zhi qian ke yi shen kao zhe ge biao 。 tong guo zhe zhong fang shi , du zhe jiu ke yi zheng que di guo lv 。 gong gong qi che shang de mei ge zuo wei dou cha yi ge xiao xi dao dui lie zhong 。 du zhe jiu ke yi jian dan di RECEIVE dao suo xu de xiao xi ( zai zhe ge guo cheng zhong , yu ding gong gong qi che shang de zuo wei )。 Service Broker hui que bao mei you xiao xi hui bei jie shou liang ci , ye jiu shi shuo ni bu hui zai yu dao bing fa wen ti le 。 SQL Server 2005 zhong qu dai le cha xun fen xi qi hui da : ni shi dui de 。 cha xun fen xi qi he qi ye guan li qi dou cong SQL Server zhong shan chu le 。 qu dai ta men de shi yi ge gong ju ,SQL Server guan li tao jian (SQL Server Management Studio)。 zhe ge gong ju ju you qian ren de da duo shu te xing , dan shi yong you sheng ji hou de yong hu jie mian he hen duo jing guo gai shan de gong neng 。 wo jiao de da duo shu de shu ju ku guan li yuan dou hui fa xian zhe shi yi ge hen hao de sheng ji 。 ru guo ni xiang yao le jie geng duo you guan SQL Server guan li tao jian de xin te xing de xin xi , qing yue du SearchSQLServer.com shang you guan zhe ge hua ti de wen zhang 。 SQL vs. T-SQL hui da : SQL shi jie gou hua cha xun yu yan , shi ANSI/ISO ren ke de biao zhun shu ju ku yu yan 。SQL Server de shi xian yu yan jiao zuo Transact-SQL (T-SQL)。T-SQL ji ben shang shi gen ju 1992 nian fa biao de ISO biao zhun chu xian de , zai 1999 nian de biao zhun shang shao jia xiu gai 。 ci wai , wei ruan huan jin xing le ge zhong si you de jia qiang 。 biao zhun SQL he T-SQL zhi jian you hen duo qu bie —— tai duo le , zhe li jiu bu shuo le 。 huan you , ru guo ni zai SQL Server shang gong zuo , na me shi yong zhe xie si you de kuo zhan shi you hao chu de 。 you yu xu duo SQL Server de te xing de ben zhi , ni bu shi yong fei biao zhun de ming ling de hua , jiang hui you hen duo qiang da de gong neng wu fa shi xian 。 ru guo ni xiang yao kan kan ni de SQL shi fou fu he biao zhun , ni ke yi shi yong SET FIPS_FLAGGER ming ling 。 SQL Server 2005 zhong shi fou you xin de suo yin lei bie le ? hui da : SQL Server 2005 mei you wei guan xi biao yin ru xin de suo yin lei xing 。 ji ben shang —— ju cu he fei ju cu suo yin shi yi B-trees de fang shi shi xian de —— huan reng ran zai ying yong 。 ran er ,SQL Server 2005 que shi bao han le yi xie suo yin shang de jia qiang , bu lun shi wan quan wen ben suo yin , huan shi dui yu XML shu ju , ci wai zhe xie jia qiang huan ke yi gai shan yi xie yu guan xi xing suo yin you guan de wen ti 。 SQL Server 2005 de wan quan wen ben suo yin te xing shi quan xin de , bing qie shi chong xin bian xie de 。 yao huo de zhe ge te xing de xin xi , qing yue du Nimish Khanolkar de MSDN guang bo wen dang , jie shao SQL Server 2005 zhong de quan wen ben cha zhao 。 XML shi SQL Server 2005 zhong ling wai yi ge zai fang shi shang fa sheng le ju da zhuan bian de nei rong 。 xian zai dui yu kai fa ren yuan lai shuo you di yi liu de XML shu ju lei xing ke yong le 。 zhe ge lei xing zhi chi XQuery cha xun yu yan , shi yong le zhe ge lei xing de zi duan ke yi tong guo te shu ge shi de XML suo yin bei suo yin dao 。 yao le jie geng duo you guan XML lei xing de xin xi , qing cha zhao MSDN shang de wen zhang 。 huan you ge zhong ge yang de you guan T-SQL suo yin ming ling de jia qiang 。 ye xu zui ling ren gan xing qu de jiu shi xin de “ zai xian ” suo yin lei xing , ta yuan xu shu ju ku guan li yuan zai bu xu yao ba yong hu suo dao biao wai mian de qing kuang xia zhi xing suo yin wei hu ren wu 。 zhe ge hen you ke neng biao ji zhe shu ju ku guan li yuan xu yao deng dao ye li 3 dian cai neng da kai wei hu chuang kou xiu zheng wen ti de zhuang kuang de zhong jie ! yao le jie geng duo you guan zhe ge te xing de xin xi , qing cha zhao SQL Server Worldwide Users Group shang de wen zhang 。 wei xing xuan ze chuang jian yi ge jiao ben xiang xiang yi xia zhe ge biao : prod_key item_key pack_key last_sale LM001 1029 AD100 2004/12/05 LM870 1029 AD100 2005/09/20 PE789 1030 BC400 2003/07/12 PE312 1030 BC400 2004/08/07 wo xiang yao xuan chu na xie zai item_key he pack_key xiang deng de qing kuang xia , ri qi bi jiao da de na yi xing 。 huan ju hua shuo , wo xiang yao : LM870 1029 AD100 2005/09/20 PE312 1030 BC400 2004/08/07 hui da : zhe ge biao you zhu jian ma ? na yang de hua cha xun ke neng hui rong yi xie 。 bu guan zen me yang , wo jiao de ni ying gai an zhao xia mian zhe yang : SELECT prod_key,item_key,pack_key,last_sale FROM (SELECT item_key,pack_key,MAX(last_sale) AS last_sale FROM tablex GROUP BY item_key,pack_key) AS MaxDateTable WHERE tablex.item_key = MaxDateTable.item_key AND tablex.pack_key = MaxDateTable.pack_key AND tablex.last_sale = MaxDateTable.last_sale lie chu mei you ji lu de shu ju ku biao wo chuang jian le yi ge dong tai de SQL Server cha xun lai shu chu biao zhong xing de shu liang 。 wo de mu biao shi lie chu zai shu ju ku zhong mei you ji lu de biao 。 cha xun ru xia suo shi : declare @strsql varchar(100) declare @tablename varchar(50) @tablename=’table123′@strsql=’ select count(*) from ‘ + @tablename exec(@strsql) wo de dao le shu chu , dan shi wo wu fa ba zhe ge zhi cun chu dao bian liang zhong yi bei cha kan 。 B<> wo xiang yao zhe yang cha kan : /* @countvariable=0 print(@tablename)*/ huan you qi ta de jie jue fang fa ma ? hui da : ni ke yi rang ni de jie jue fang an geng jia ling huo yi xie , tong guo cong sysobjects biao zhong zhua qu biao ming : declare @strsql varchar(256) create table #emptytables (tablename varchar(128), table_rowcount int)select @strsql=’select distinct o.name as TableName, .rowcnt as Table_RowCount from sysobjects o inner join sysindexes x on o.id = x.id where x.rowcnt = 0 and o.type = ‘’U”’insert #emptytables (TableName, Table_rowcount) exec (@strsql) select * from #emptytables drop table #emptytables
󰈣󰈤
  免责声明:本文仅代表作者个人观点,与王朝网络无关。王朝网络登载此文出于传递更多信息之目的,并不意味着赞同其观点或证实其描述,其原创性以及文中陈述文字和内容未经本站证实,对本文以及其中全部或者部分内容、文字的真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
 
 
温柔美女韩雪写真
杨幂全新写真
网易红人PLMM草梅队长
河智苑Compagna09春装
看 这就是我的学校
惠山古迹区
雪后看花仙
元宵烟火
 
>>返回首页<<
 为你推荐
 
 
 转载本文
 UBB代码 HTML代码
复制到剪贴板...
 
 热帖排行
 
 
 
 
©2005- 王朝网络 版权所有