sql server 2000中制止創立表(權限設置辦法)。本站提示廣大學習愛好者:(sql server 2000中制止創立表(權限設置辦法))文章只能為提供參考,不一定能成為您想要的結果。以下是sql server 2000中制止創立表(權限設置辦法)正文
在某些情形下熟習SQL Server 通配符的應用可以贊助我們簡略的處理許多成績。
--應用_運算符查找Person表中以an開頭的三字母名字 USEAdventureWorks2012; GO SELECT FirstName, LastName FROM Person.Person WHERE FirstName LIKE'_an' ORDER BY FirstName; ---應用[^]運算符在Contact表中查找一切名字以Al開首且第三個字母不是字母a的人 USEAdventureWorks2012; GO SELECT FirstName, LastName FROM Person.Person WHERE FirstName LIKE'Al[^a]%' ORDER BY FirstName; ---應用[]運算符查找其地址中有四位郵政編碼的一切Adventure Works雇員的ID和姓名 USEAdventureWorks2012; GO SELECT e.BusinessEntityID, p.FirstName, p.LastName, a.PostalCode FROMHumanResources.EmployeeAS e INNER JOIN Person.PersonAS pON e.BusinessEntityID= p.BusinessEntityID INNER JOIN Person.BusinessEntityAddressAS eaON e.BusinessEntityID=ea.BusinessEntityID INNER JOIN Person.AddressAS aON a.AddressID= ea.AddressID WHERE a.PostalCodeLIKE'[0-9][0-9][0-9][0-9]';
成果集:
EmployeeID FirstName LastName PostalCode ---------- --------- --------- ---------- 290 Lynn Tsoflias 3000
--將一張表中名字為中英文的辨別出來(自創服裝論壇t.vhao.net中的代碼) create table tb(namenvarchar(20)) insert into tbvalues('kevin') insert into tbvalues('kevin劉') insert into tbvalues('劉') select *,'Eng'from tbwherepatindex('%[a-z]%',name)>0and(patindex('%[吖-坐]%',name)=0) union all select *,'CN'from tbwherepatindex('%[吖-坐]%',name)>0andpatindex('%[a-z]%',name)=0 union all select *,'Eng&CN'from tbwhere(patindex('%[吖-坐]%',name)>0)andpatindex('%[a-z]%',name)>0
成果集:
name -------------------- ------ kevin Eng 劉 CN kevin劉 Eng&CN (3 row(s) affected)