当前位置:首页 » 编程语言 » 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%' );

这样可以了