當前位置:首頁 » 編程語言 » sql改寧
擴展閱讀
webinf下怎麼引入js 2023-08-31 21:54:13
堡壘機怎麼打開web 2023-08-31 21:54:11

sql改寧

發布時間: 2022-07-06 14:11:33

1. sql中30位元組應該用什麼類型

如果考慮性能速度 應該用char(30)
如果考慮存儲空間 則用varchar(30)

如果你還需要考慮中文的情況 則可以嘗試下nvarchar(30)(不過這個可不是30位元組 呵呵)

2. SQL 資料庫網站應該怎麼做伺服器環境

其實,如果你只是為了簡單的使用SQL SEVER資料庫,只需按照你已經有的SQL動易網站幫助文檔,按其說明步驟,一步步創建資料庫,數據表等等,就已經達到」可用」這個基本目的了.
但是,如果你是要配置一個安全性高的sql資料庫伺服器,則要注意很多很多問題,並不是一件很簡單的事情.下面具體說明如何安全配置sql server伺服器,主要針對sql server 2000.

1.1. 第一步
打上SQLSERVER最新的安全補丁,現在補丁已經出到了SP3。下載地址網上搜一下。如果這一步都沒有做好,那我們也沒有繼續下去的必要了。

1.2. 第二步

修改默認的1433埠,並且將SQL SERVER隱藏。這樣能禁止對試圖枚舉網路上現有的SQL Server客戶端所發出的廣播做出響應。另外,還需要在TCP/IP篩選中將1433埠屏蔽掉,盡可能的隱藏你的SQL SERVER資料庫。這樣既便讓攻擊創建了SQL SERVER的賬號,也不能馬上使用查詢分析器遠程登陸來進行下一步的攻擊。單從ASP,PHP等頁面構造惡意語句的話,還有需要查看返回值的問題,總比不上直接查詢分析器來得利落。所以我們首先要做到即使讓別人注入了,也不能讓攻擊者下一步做得順當。修改方法:

企業管理器--> 你的資料庫組 --> 屬性 --> 常規 --> 網路配置 --> TCP/IP --> 屬性,在這兒將你的默認埠進行修改,和SQL SERVER的隱藏。

1.3.第三步

SQL INJECTION(sql注入)往往在Web CODE中產生,而作為系統管理員或者資料庫管理員,總不能常常的去看每一段代碼。即使常常看代碼,也不能保證我們在上面的疏忽。那怎麼辦?我們就要從資料庫角色著手,讓資料庫用戶的許可權劃分到最低點。SQL SERVER的默認許可權讓人真的很頭疼,許可權大得非常的高,許可權小的又什麼都做不了,SYSADMIN和DB_OWNER 真是讓人又愛又恨。攻擊者一但確認了網站存在SQL INJECTION漏洞,肯定有一步操作步驟就是測試網站的SQL SERVER使用者具有多大的許可權。一般都會藉助
SELECT IS_SRVROLEMEMBER('sysadmin')
或者
SELECT IS_MEMBER('db_owner')
再或者
user =0
(讓字元和數字進行比較,SQL SERVER就會提示了錯誤信息,從該信息中即可知道一些敏感信息)等語句進行測試。當然還有其他的方法。在當前,如果網站的資料庫使用者用的是SA許可權,再加上確認了WEB所處在的絕對路徑,那麼就宣告了你的網站的OVER。DB_OWNER許可權也一樣,如果確認了絕對路徑,那麼有50%的機會能給你的機器中上WEB方式的木馬,如海陽等。所以這兒我們確認了一點,我們必須要創建自已的許可權,讓攻擊者找不著下手的地方。在這兒引用一個SQL SERVER聯機幫助中的例子:

創建 SQL Server 資料庫角色的方法(企業管理器)
創建 SQL Server 資料庫角色
1. 展開伺服器組,然後展開伺服器。
2. 展開"資料庫"文件夾,然後展開要在其中創建角色的資料庫。
3. 右擊"角色",然後單擊"新建資料庫角色"命令。
4. 在"名稱"框中輸入新角色的名稱。
5. 單擊"添加"將成員添加到"標准角色"列表中,然後單擊要添加的一個或多個用戶。(可選)
只有選定資料庫中的用戶才能被添加到角色中。
對象許可權
處理數據或執行過程時需要稱為對象許可權的許可權類別:
• SELECT、INSERT、UPDATE 和 DELETE 語句許可權,它們可以應用到整個表或視圖中。
• SELECT 和 UPDATE 語句許可權,它們可以有選擇性地應用到表或視圖中的單個列上。
• SELECT 許可權,它們可以應用到用戶定義函數。
• INSERT 和 DELETE語句許可權,它們會影響整行,因此只可以應用到表或視圖中,而不能應用到單個列上。
• EXECUTE 語句許可權,它們可以影響存儲過程和函數。

語句許可權

創建資料庫或資料庫中的項(如表或存儲過程)所涉及的活動要求另一類稱為語句許可權的許可權。例如,如果用戶必須能夠在資料庫中創建表,則應該向該用戶授予
CREATE TABLE 語句許可權。語句許可權(如 CREATE DATABASE)適用於語句自身,而不適用於資料庫中定義的特定對象。
語句許可權有:
• BACKUP DATABASE
• BACKUP LOG
• CREATE DATABASE
• CREATE DEFAULT
• CREATE FUNCTION
• CREATE PROCEDURE
• CREATE RULE
• CREATE TABLE
• CREATE VIEW

暗示性許可權

暗示性許可權控制那些只能由預定義系統角色的成員或資料庫對象所有者執行的活動。例如,sysadmin。
固定伺服器角色成員自動繼承在 SQL Server 安裝中進行操作或查看的全部許可權。
資料庫對象所有者還有暗示性許可權,可以對所擁有的對象執行一切活動。例如,擁有表的用戶可以查看、添加或刪除數據,更改表定義,或控制允許其他用戶對表進行操作的許可權。
db_owner 在資料庫中有全部許可權。
db_Accessadmin 可以添加或刪除用戶 ID。
db_securityadmin 可以管理全部許可權、對象所有權、角色和角色成員資格。
db_ddladmin 可以發出 ALL DDL,但不能發出 GRANT、REVOKE 或DENY 語句。
db_backupoperator 可以發出 DBCC、CHECKPOINT 和 BACKUP 語句。
db_datareader 可以選擇資料庫內任何用戶表中的所有數據。
db_datawriter 可以更改資料庫內任何用戶表中的所有數據。
db_denydatareader 不能選擇資料庫內任何用戶表中的任何數據。
db_denydatawriter 不能更改資料庫內任何用戶表中的任何數據。

在這兒把新建的資料庫角色的許可權配置好,比如需要使用哪個表、視圖、存儲過程等。然後把db_owner和db_securityadmin、db_backupoperator取消,不給攻擊者BACKUP DATABASE和CREATE TABLE的機會,一但攻擊者具有這兩個許可權,那麼你的網站就還處在十分危險的狀態。還有注意一下,在創建資料庫賬號時,千萬不能對伺服器角色進行選擇。

1.4.第四步

修改SQL SERVER內置存儲過程。
SQLSERVER估計是為了安裝或者其它方面,它內置了一批危險的存儲過程。能讀到注冊表信息,能寫入注冊表信息,能讀磁碟共享信息等等……各位看到這兒,心裡可能會在想,我的網站中有其它的代碼,又不像查詢分析器那樣能直接將結果輸出。給你這個許可權,也不能怎麼樣,還是看不到信息。如果各位這樣想就大錯特錯了。提示一下,如果攻擊者有CREATE TABLE的許可權,那麼創建一個臨時表,然後將信息INSERT到表中,然SELECT出來,接著跟數字進行比較,讓SQL SERVER報錯,那麼結果就全出來了……所以我們要報著寧錯殺,不放過的態度進行修補。
先來列出危險的內置存儲過程:
xp_cmdshell
xp_regaddmultistring
xp_regdeletekey
xp_regdeletevalue
xp_regenumkeys
xp_regenumvalues
xp_regread
xp_regremovemultistring
xp_regwrite

ActiveX自動腳本
sp_OACreate
sp_OADestroy
sp_OAMethod
sp_OAGetProperty
sp_OASetProperty
sp_OAGetErrorInfo
sp_OAStop
以上各項全在我們封殺之列,例如xp_cmdshell屏蔽的方法為:sp_dropextendedproc 'xp_cmdshell' 。如果需要的話,再用sp_addextendedproc 'xp_cmdshell', 'xpsql70.dll' 進行恢復。如果你不知道xp_cmdshell使用的是哪個.dll文件的話,可以使用sp_helpextendedproc xp_cmdshel來查看xp_cmdshell使用的是哪個動態聯接庫。另外,將xp_cmdshell屏蔽後,我們還需要做的步驟是將xpsql70.dll文件進行改名,以防止獲得SA的攻擊者將它進行恢復。

1.5. 結語
我們做到這兒,你的SQL SERVER就基本上安全了。但是安全終究是相對的,不可能百分之百,除非你的網站用的是HTML。

3. sql,字元串中取數字

1、創建測試表,

create table test_str(id int, v_str varchar2(20));

4. sql資料庫查詢兩個表之間時間的比較

我們通常使用的表之間的聯接是等值聯接;你的情況需要使用外聯接來做。 我按照你的意思分別見了table1,table2,table0(對應你的table表),並把你的數據也增加進去了。 執行下面的SQL可能會得到你想要的結果: (selecttable1.hm,table1.no1,table2.(table1.hm=table2.hm)wheretable1.hmisnotnull) union (selecttable2.hm,table1.no1,table2.(table1.hm=table2.hm)wheretable2.hmisnotnull) 輸出結果如下:
希望是你想要的! 剛才沒用到table0表,如果保證hm的值必須在table0中,如要修改上面的SQL如下: select*from(selecttable1.hmashm,table1.no1,table2.(table1.hm=table2.hm)wheretable1.hmisnotnull union selecttable2.hmashm,table1.no1,table2.(table1.hm=table2.hm)wheretable2.hmisnotnull)astwheret.hmin(selecthmfromtable0) 這樣,當table1,table2中的hm值不在table0表中,查詢結果就不會出現。 外聯接,包括左外聯接、右外聯接、全外聯接的確大多數的程序員都不使用。寧肯用很長的程序代碼來實現,但是用資料庫sql來實現其實效率是最快的。 建議你了解外聯接的知識。

5. 俺是Sql業余,請教高手Sql庫中兩個表級聯查詢問題 ,急 !!!!

建立如下函數,以解決全拼音的情況,

調用時用Select dbo.f_GetPy(漢字,分隔符)

以下是函數創建方法:
CREATE function f_GetPy(@str varchar(100),@separator varchar(10))
returns varchar(8000)
as
begin
declare @re varchar(8000)
--生成臨時表
declare @t table(chr nchar(1) collate Chinese_PRC_CS_AS_KS_WS,py nvarchar(20))
insert into @t select'吖','a'
insert into @t select'厑','aes'
insert into @t select'哎','ai'
insert into @t select'安','an'
insert into @t select'骯','ang'
insert into @t select'凹','ao'
insert into @t select'八','ba'
insert into @t select'挀',''
insert into @t select'兡','ke'
insert into @t select'瓸','wa'
insert into @t select'扳','ban'
insert into @t select'邦','bang'
insert into @t select'勹','bao'
insert into @t select'萡','be'
insert into @t select'陂','bei'
insert into @t select'奔','ben'
insert into @t select'伻','beng'
insert into @t select'皀','bi'
insert into @t select'邊','bian'
insert into @t select'辪','uu'
insert into @t select'灬','biao'
insert into @t select'憋','bie'
insert into @t select'汃','bin'
insert into @t select'冫','bing'
insert into @t select'癶','bo'
insert into @t select'峬','bu'
insert into @t select'嚓','ca'
insert into @t select'偲','cai'
insert into @t select'乲','cal'
insert into @t select'參','can'
insert into @t select'倉','cang'
insert into @t select'撡','cao'
insert into @t select'冊','ce'
insert into @t select'膥','cen'
insert into @t select'噌','ceng'
insert into @t select'硛','ceok'
insert into @t select'岾','ceom'
insert into @t select'猠','ceon'
insert into @t select'乽','ceor'
insert into @t select'叉','cha'
insert into @t select'犲','chai'
insert into @t select'辿','chan'
insert into @t select'倀','chang'
insert into @t select'抄','chao'
insert into @t select'車','che'
insert into @t select'抻','chen'
insert into @t select'阷','cheng'
insert into @t select'吃','chi'
insert into @t select'充','chong'
insert into @t select'抽','chou'
insert into @t select'出','chu'
insert into @t select'膗','chuai'
insert into @t select'巛','chuan'
insert into @t select'刅','chuang'
insert into @t select'吹','chui'
insert into @t select'旾','chun'
insert into @t select'踔','chuo'
insert into @t select'呲','ci'
insert into @t select'嗭','cis'
insert into @t select'從','cong'
insert into @t select'湊','cou'
insert into @t select'粗','cu'
insert into @t select'氽','cuan'
insert into @t select'崔','cui'
insert into @t select'邨','cun'
insert into @t select'瑳','cuo'
insert into @t select'撮','chua'
insert into @t select'咑','da'
insert into @t select'呔','dai'
insert into @t select'丹','dan'
insert into @t select'當','dang'
insert into @t select'刀',''
insert into @t select'恴','de'
insert into @t select'揼','dem'
insert into @t select'扥','den'
insert into @t select'燈','deng'
insert into @t select'仾','di'
insert into @t select'嗲','dia'
insert into @t select'敁','dian'
insert into @t select'刁','diao'
insert into @t select'爹','die'
insert into @t select'哋','dei'
insert into @t select'嚸','dim'
insert into @t select'丁','ding'
insert into @t select'丟','diu'
insert into @t select'東','dong'
insert into @t select'吺','dou'
insert into @t select'剢',''
insert into @t select'專','an'
insert into @t select'叾','g'
insert into @t select'垖','i'
insert into @t select'噸','n'
insert into @t select'咄','o'
insert into @t select'妸','e'
insert into @t select'奀','en'
insert into @t select'鞥','eng'
insert into @t select'仒','eo'
insert into @t select'乻','eol'
insert into @t select'旕','eos'
insert into @t select'兒','er'
insert into @t select'發','fa'
insert into @t select'帆','fan'
insert into @t select'匚','fang'
insert into @t select'飛','fei'
insert into @t select'吩','fen'
insert into @t select'豐','feng'
insert into @t select'瓰','fenwa'
insert into @t select'覅','fiao'
insert into @t select'仏','fo'
insert into @t select'垺','fou'
insert into @t select'夫','fu'
insert into @t select'猤','fui'
insert into @t select'旮','ga'
insert into @t select'侅','gai'
insert into @t select'甘','gan'
insert into @t select'岡','gang'
insert into @t select'皋','gao'
insert into @t select'戈','ge'
insert into @t select'給','gei'
insert into @t select'根','gen'
insert into @t select'更','geng'
insert into @t select'啹','geu'
insert into @t select'喼','gib'
insert into @t select'嗰','go'
insert into @t select'工','gong'
insert into @t select'兝','gongfen'
insert into @t select'兣','gongli'
insert into @t select'勾','gou'
insert into @t select'估','gu'
insert into @t select'瓜','gua'
insert into @t select'乖','guai'
insert into @t select'關','guan'
insert into @t select'光','guang'
insert into @t select'歸','gui'
insert into @t select'丨','gun'
insert into @t select'咼','guo'
insert into @t select'妎','ha'
insert into @t select'咍','hai'
insert into @t select'乤','hal'
insert into @t select'兯','han'
insert into @t select'魧','hang'
insert into @t select'茠','hao'
insert into @t select'兞','haoke'
insert into @t select'訶','he'
insert into @t select'黒','hei'
insert into @t select'拫','hen'
insert into @t select'亨','heng'
insert into @t select'囍','heui'
insert into @t select'乊','ho'
insert into @t select'乥','hol'
insert into @t select'叿','hong'
insert into @t select'齁','hou'
insert into @t select'乎','hu'
insert into @t select'花','hua'
insert into @t select'徊','huai'
insert into @t select'歡','huan'
insert into @t select'巟','huang'
insert into @t select'灰','hui'
insert into @t select'昏','hun'
insert into @t select'吙','huo'
insert into @t select'嚿','geo'
insert into @t select'夻','hwa'
insert into @t select'丌','ji'
insert into @t select'加','jia'
insert into @t select'嗧','jialun'
insert into @t select'戔','jian'
insert into @t select'江','jiang'
insert into @t select'艽','jiao'
insert into @t select'階','jie'
insert into @t select'巾','jin'
insert into @t select'坕','jing'
insert into @t select'冂','jiong'
insert into @t select'丩','jiu'
insert into @t select'欍','jou'
insert into @t select'凥','ju'
insert into @t select'姢','juan'
insert into @t select'噘','jue'
insert into @t select'軍','jun'
insert into @t select'咔','ka'
insert into @t select'開','kai'
insert into @t select'乫','kal'
insert into @t select'刊','kan'
insert into @t select'冚','hem'
insert into @t select'砊','kang'
insert into @t select'尻','kao'
insert into @t select'坷','ke'
insert into @t select'肎','ken'
insert into @t select'劥','keng'
insert into @t select'巪','keo'
insert into @t select'乬','keol'
insert into @t select'唟','keos'
insert into @t select'厼','keum'
insert into @t select'怾','ki'
insert into @t select'空','kong'
insert into @t select'廤','kos'
insert into @t select'摳','kou'
insert into @t select'扝','ku'
insert into @t select'誇','kua'
insert into @t select'蒯','kuai'
insert into @t select'寬','kuan'
insert into @t select'匡','kuang'
insert into @t select'虧','kui'
insert into @t select'坤','kun'
insert into @t select'拡','kuo'
insert into @t select'穒','kweok'
insert into @t select'垃','la'
insert into @t select'來','lai'
insert into @t select'蘭','lan'
insert into @t select'啷','lang'
insert into @t select'撈','lao'
insert into @t select'仂','le'
insert into @t select'雷','lei'
insert into @t select'塄','leng'
insert into @t select'唎','li'
insert into @t select'倆','lia'
insert into @t select'嫾','lian'
insert into @t select'簗','liang'
insert into @t select'蹽','liao'
insert into @t select'毟','lie'
insert into @t select'厸','lin'
insert into @t select'伶','ling'
insert into @t select'溜','liu'
insert into @t select'瓼','liwa'
insert into @t select'囖','lo'
insert into @t select'龍','long'
insert into @t select'婁','lou'
insert into @t select'嚕','lu'
insert into @t select'驢','lv'
insert into @t select'寽','lue'
insert into @t select'孿','luan'
insert into @t select'掄','lun'
insert into @t select'頱','luo'
insert into @t select'呣','m'
insert into @t select'媽','ma'
insert into @t select'遤','hweong'
insert into @t select'埋','mai'
insert into @t select'顢','man'
insert into @t select'牤','mang'
insert into @t select'匁','mangmi'
insert into @t select'貓','mao'
insert into @t select'唜','mas'
insert into @t select'庅','me'
insert into @t select'呅','mei'
insert into @t select'椚','men'
insert into @t select'掹','meng'
insert into @t select'踎','meo'
insert into @t select'眯','mi'
insert into @t select'宀','mian'
insert into @t select'喵','miao'
insert into @t select'乜','mie'
insert into @t select'瓱','miliklanm'
insert into @t select'民','min'
insert into @t select'冧','lem'
insert into @t select'名','ming'
insert into @t select'謬','miu'
insert into @t select'摸','mo'
insert into @t select'乮','mol'
insert into @t select'哞','mou'
insert into @t select'母','mu'
insert into @t select'旀','myeo'
insert into @t select'丆','myeon'
insert into @t select'椧','myeong'
insert into @t select'拏','na'
insert into @t select'腉','nai'
insert into @t select'囡','nan'
insert into @t select'囔','nang'
insert into @t select'乪','keg'
insert into @t select'孬','nao'
insert into @t select'疒','ne'
insert into @t select'娞','nei'
insert into @t select'焾','nem'
insert into @t select'嫩','nen'
insert into @t select'莻','neus'
insert into @t select'鈪','ngag'
insert into @t select'銰','ngai'
insert into @t select'啱','ngam'
insert into @t select'妮','ni'
insert into @t select'年','nian'
insert into @t select'娘','niang'
insert into @t select'蔦','niao'
insert into @t select'捏','nie'
insert into @t select'脌','nin'
insert into @t select'寧','ning'
insert into @t select'牛','niu'
insert into @t select'農','nong'
insert into @t select'羺','nou'
insert into @t select'奴','nu'
insert into @t select'女','nv'
insert into @t select'瘧','nue'
insert into @t select'瘧','nve'
insert into @t select'奻','nuan'
insert into @t select'黁','nun'
insert into @t select'燶','nung'
insert into @t select'挪','nuo'
insert into @t select'筽','o'
insert into @t select'夞','oes'
insert into @t select'乯','ol'
insert into @t select'鞰','on'
insert into @t select'謳','ou'
insert into @t select'妑','pa'
insert into @t select'俳','pai'
insert into @t select'磗','pak'
insert into @t select'眅','pan'
insert into @t select'乓','pang'
insert into @t select'拋','pao'
insert into @t select'呸','pei'
insert into @t select'瓫','pen'
insert into @t select'匉','peng'
insert into @t select'浌','peol'
insert into @t select'巼','phas'
insert into @t select'闏','phdeng'
insert into @t select'乶','phoi'
insert into @t select'喸','phos'
insert into @t select'丕','pi'
insert into @t select'囨','pian'
insert into @t select'縹','piao'
insert into @t select'氕','pie'
insert into @t select'丿','pianpang'
insert into @t select'姘','pin'
insert into @t select'乒','ping'
insert into @t select'釙','po'
insert into @t select'剖','pou'
insert into @t select'哣','deo'
insert into @t select'兺','ppun'
insert into @t select'仆','pu'
insert into @t select'七','qi'
insert into @t select'掐','qia'
insert into @t select'千','qian'
insert into @t select'羌','qiang'
insert into @t select'兛','qianke'
insert into @t select'瓩','qianwa'
insert into @t select'悄','qiao'
insert into @t select'苆','qie'
insert into @t select'親','qin'
insert into @t select'蠄','kem'
insert into @t select'氫','qing'
insert into @t select'銎','qiong'
insert into @t select'丘','qiu'
insert into @t select'曲','qu'
insert into @t select'迲','keop'
insert into @t select'峑','quan'
insert into @t select'蒛','que'
insert into @t select'夋','qun'
insert into @t select'亽','ra'
insert into @t select'囕','ram'
insert into @t select'呥','ran'
insert into @t select'穣','rang'
insert into @t select'蕘','rao'
insert into @t select'惹','re'
insert into @t select'人','ren'
insert into @t select'扔','reng'
insert into @t select'日','ri'
insert into @t select'栄','rong'
insert into @t select'禸','rou'
insert into @t select'嶿','ru'
insert into @t select'撋','ruan'
insert into @t select'桵','rui'
insert into @t select'閏','run'
insert into @t select'叒','ruo'
insert into @t select'仨','sa'
insert into @t select'栍','saeng'
insert into @t select'毢','sai'
insert into @t select'虄','sal'
insert into @t select'三','san'
insert into @t select'桒','sang'
insert into @t select'掻','sao'
insert into @t select'色','se'
insert into @t select'裇','sed'
insert into @t select'聓','sei'
insert into @t select'森','sen'
insert into @t select'鬙','seng'
insert into @t select'閪','seo'
insert into @t select'縇','seon'
insert into @t select'殺','sha'
insert into @t select'篩','shai'
insert into @t select'山','shan'
insert into @t select'傷','shang'
insert into @t select'弰','shao'
insert into @t select'奢','she'
insert into @t select'申','shen'
insert into @t select'升','sheng'
insert into @t select'屍','shi'
insert into @t select'兙','shike'
insert into @t select'瓧','shiwa'
insert into @t select'収','shou'
insert into @t select'書','shu'
insert into @t select'刷','shua'
insert into @t select'摔','shuai'
insert into @t select'閂','shuan'
insert into @t select'雙','shuang'
insert into @t select'誰','shei'
insert into @t select'脽','shui'
insert into @t select'吮','shun'
insert into @t select'哾','shuo'
insert into @t select'絲','si'
insert into @t select'螦','so'
insert into @t select'乺','sol'
insert into @t select'忪','song'
insert into @t select'凁','sou'
insert into @t select'蘇','su'
insert into @t select'酸','suan'
insert into @t select'夊','sui'
insert into @t select'孫','sun'
insert into @t select'娑','suo'
insert into @t select'他','ta'
insert into @t select'襨','tae'
insert into @t select'囼','tai'
insert into @t select'坍','tan'
insert into @t select'鐋','tang'
insert into @t select'仐','tao'
insert into @t select'畓','tap'
insert into @t select'忒','te'
insert into @t select'膯','teng'
insert into @t select'唞','teo'
insert into @t select'朰','teul'
insert into @t select'剔','ti'
insert into @t select'天','tian'
insert into @t select'旫','tiao'
insert into @t select'怗','tie'
insert into @t select'廳','ting'
insert into @t select'乭','tol'
insert into @t select'囲','tong'
insert into @t select'偷','tou'
insert into @t select'凸','tu'
insert into @t select'湍','tuan'
insert into @t select'推','tui'
insert into @t select'旽','tun'
insert into @t select'乇','tuo'
insert into @t select'屲','wa'
insert into @t select'歪','wai'
insert into @t select'乛','wan'
insert into @t select'尣','wang'
insert into @t select'危','wei'
insert into @t select'塭','wen'
insert into @t select'翁','weng'
insert into @t select'撾','wo'
insert into @t select'烏','wu'
insert into @t select'夕','xi'
insert into @t select'誒','ei'
insert into @t select'疨','xia'
insert into @t select'仙','xian'
insert into @t select'鄉','xiang'
insert into @t select'灱','xiao'
insert into @t select'楔','xie'
insert into @t select'心','xin'
insert into @t select'星','xing'
insert into @t select'凶','xiong'
insert into @t select'休','xiu'
insert into @t select'旴','xu'
insert into @t select'昍','xuan'
insert into @t select'疶','xue'
insert into @t select'坃','xun'
insert into @t select'丫','ya'
insert into @t select'咽','yan'
insert into @t select'欕','eom'
insert into @t select'央','yang'
insert into @t select'吆','yao'
insert into @t select'椰','ye'
insert into @t select'膶','yen'
insert into @t select'一','yi'
insert into @t select'乁','i'
insert into @t select'乚','yin'
insert into @t select'應','ying'
insert into @t select'喲','yo'
insert into @t select'佣','yong'
insert into @t select'優','you'
insert into @t select'迂','yu'
insert into @t select'囦','yuan'
insert into @t select'曰','yue'
insert into @t select'蒀','yun'
insert into @t select'帀','za'
insert into @t select'災','zai'
insert into @t select'兂','zan'
insert into @t select'牂','zang'
insert into @t select'遭','zao'
insert into @t select'啫','ze'
insert into @t select'賊','zei'
insert into @t select'怎','zen'
insert into @t select'曽','zeng'
insert into @t select'吒','zha'
insert into @t select'甴','gad'
insert into @t select'夈','zhai'
insert into @t select'氈','zhan'
insert into @t select'張','zhang'
insert into @t select'釗','zhao'
insert into @t select'蜇','zhe'
insert into @t select'貞','zhen'
insert into @t select'凧','zheng'
insert into @t select'之',''
insert into @t select'中','zhong'
insert into @t select'州','zhou'
insert into @t select'劯','zhu'
insert into @t select'抓','zhua'
insert into @t select'專','zhuan'
insert into @t select'轉','zhuai'
insert into @t select'妝','zhuang'
insert into @t select'騅','zhui'
insert into @t select'宒','zhun'
insert into @t select'卓','zhuo'
insert into @t select'孜','zi'
insert into @t select'唨','zo'
insert into @t select'宗','zong'
insert into @t select'棸','zou'
insert into @t select'哫','zu'
insert into @t select'劗','zuan'
insert into @t select'厜','zui'
insert into @t select'尊','zun'
insert into @t select'昨','zuo'

declare @strlen int
select @strlen=len(@str),@re=''
while @strlen>0
begin
select top 1 @re=UPPER(substring(py,1,1) )+substring(py,2,len(py))+@separator+@re,@strlen=@strlen-1
from @t a where chr<=substring(@str,@strlen,1)
order by chr collate Chinese_PRC_CS_AS_KS_WS desc
if @@rowcount=0
select @re=substring(@str,@strlen,1)+@re,@strlen=@strlen-1
end
return(@re)
end

------------------------------------------

下一步就直接建立視圖就可以了

Create View View_C

as

Select id,pname,jp,dbo.f_GetPy(pname,'') as p,dbo.f_GetPy(pname,' ') as fp

From TableA

6. 兩個SQL資料庫之間能不能復制數據表

可以的,MS的SQLServer提供了相應的功能來解決這個問題
具體操作是:>在你需要復制到的資料庫上點右鍵->所有任務->導入數據->然後第一步的數據源那裡改成你的源資料庫->下一步->下一步->下一步->勾上你要復制的表和視圖->再一路到底下一步就可以了

7. 鬼是什麼

對於鬼,很多人抱著「寧可信其有,不可信其無」的混沌態度,讓迷信鑽了空子。今天,lao5就來論證一下,鬼,是不存在的

因為對於鬼這個概念,沒有正式的定義。基本上,根據傳說,這個東東有這樣幾個特徵:

1. 來源 :鬼來源於人 ,人死了以後變成鬼 ,鬼投胎變成人 人是鬼的唯一來源。
2. 鬼自己不會繁衍後代,如同上面所說,人是鬼的唯一來源。
3. 鬼有形體,但是也有些虛幻,飄忽不定,有些像氣態的
4. 鬼有三種去向:1)萬劫不復,被判官或者神仙消滅,消失了 2)投胎變成人 3)無法投胎,變成孤魂夜鬼
5. 人(現代人)都是鬼投胎變的,第一批人是女媧做的,後來女媧不造人了,人的來源只剩下一個,那就是由鬼投胎。

以上是咱們東方人的所謂「鬼」的概念,我下面證明「鬼」不存在,就是證明這樣的鬼不存在。也許有別的特徵的鬼,但是我不知道,等我知道了,

再一一批駁。

證明:

第一批人是造人者女媧造的,後來不造了,設第一批人的數量為 x
人死了變成了鬼,鬼來源於人,鬼的數目小於 x
現在人的數量,大約是50億,數目小於 x
第一批人造好以後,有三種去向: 1)在人間50億 2)在陰間,尚未投胎 3)沒法投胎的夜鬼或者被消滅的惡鬼

這里,一個有趣的問題是, 人間和陰間的數目,比例大約是多少?

這要看第一批人,第一批人,假如50年的時間,死掉1/5,出生1/10的話,人間和陰間人數目比例是 9:1

實際上,陰間的數目要遠小於總數的1/10 ,因為人類要生存,死亡率必須小於等於出生率

所以得出一個結論: 如果有鬼的話,數目非常稀少,因為鬼要忙著投胎,流動數目也許很大,絕對數目很少,這倒也是,幾千年來陰間的官僚

機構一直很小,只有閻王和判官寥寥數人,除了等級新鬼和打發投胎,平時也沒多少業務可作。黃巢故事裡面說,陰間得知將要發生戰爭,死

很多人,小鬼忙著抄寫《生死簿》,白天干不完晚上加班,偷寺廟和尚的燈油。可見陰間的公務員數目很少,辦公條件很差,信息化程度也不

高(其實就是改變人的標志欄位,把「生」改成「死」,一個sql就行了,還加班~~)

* * *

但是以上的結論並不完美,人從古到今,生存這么多年,難道一直都是 死亡率大於等於出生率 嗎??如果是的話,那女媧造的第一批人要數

目很大才對,不然實在賠不起。

實際上,從表面上看,人類大體上都是死亡率必須小於等於出生率的,就算是發生戰爭,死很多人的話,在往後人民也是慢慢的又繁盛起來的

。這個我沒有查資料確實,歷史界的朋友可以幫忙查證一下。

更讓人迷惑不解的是,最近100年人口爆長,假使100年前人鬼比例大約是9:1的話,我們可以預料人類在往後就沒有孩子可以生了——鬼都

要投胎完了。這是很緊迫的問題,舊中國4億人,現在都快13億了,鬼的數目肯定是銳減,而且還帶來孟婆湯的緊缺問題、鬼種族的大量遷徙

問題等諸多問題。

* * *
其實也可以這樣解釋,女媧一開始造人,第一批人造好後,馬上over了一大批,為千秋萬代留下了諸多「人源」 ,可是牽強的是,馬上over的原

因不是那麼好解釋的,第一批人產生後居住區域一定不會很分散,要是彗星撞地球、核爆炸等災難,那也是「要死一起死」的……

除非女媧造好第一批人以後,馬上殺了一半?? 不會吧,女媧有著么狠?難道她看到了幾千年後「鬼之有無」的爭論?目光實在長遠,呵呵

還有一種解釋,是女媧造好人後,造了一定數量的鬼。呵呵,這樣就好解釋了。女媧都給我們算計好了,造的鬼夠人類出生n年的……

女媧造鬼????可惜從來沒有任何記載

* * *

算了,還是算帳吧。

女媧造人,一開始用泥活泥人,這樣造人,效率很低啊,不信你造一個試試,一天能造20個就不錯啦。
女媧也意識到這個效率 問題,為了後世繁衍,她只好用藤條蘸泥塘向外甩,人就如天女散花一般,紛紛出生了

我們假設一開始活泥人,一天做50個(已經很累了),做了三天 ===》 三天150個人
然後用藤條甩,5分鍾甩一下,一天8小時,甩一下產生10000人 ===》一天10000*8*(60/5)=960000人

把150人忽略不計、把孤魂夜鬼數量忽略不計,把陰間的鬼數量也忽略不計,只計算50億人的產生

50000000000/960000 大約是52000天,也就是142.47年,可憐的女媧,辛苦了,人民永遠紀念你……

8. 一個簡單的SQL語句問題。

哎,這個怎麼說呢,NULL是個比較奇怪的東西。NULL永遠不會有什麼數據與之相等或不相等。
對於這個只能單獨加個or了
select * from test where name!='lili' or name is null;

9. sql為啥我插入insert into customers values('001','寧','江

您好
插入了一條記錄,一條記錄被更改,被刪除,都是 1行受影響

也就是對一條記錄進行了操作

10. sql語句在一定的范圍里模糊查詢

說明一個小問題, OR的優先順序要比AND低那麼一點點(真的,他倆排倒數1和2)
所以你的語句邏輯是錯的
如果你吃不準優先順序,推薦你用萬能的括弧

select * from table where class1 = 4 and (biaoti like '%aa%' or company like '%aa%' );

這樣可以了